存储过程、插入数据后直接过去主键id
DECLARE @sql nvarchar(4000) DECLARE @cou int SET @sql='INSERT INTO people values('''+'xiaohong'+''');select @temp=@@IDENTITY' EXEC sp_executesql @sql, N'@temp int out', @cou OUT INSERT INTO child VALUES(@cou, '小兰')
CREATE PROC chjj @name nvarchar(1000) AS BEGIN DECLARE @sql nvarchar(4000) DECLARE @cou int SET @sql='INSERT INTO people values('''+@name+''');select @temp=@@IDENTITY' EXEC sp_executesql @sql, N'@temp int out', @cou OUT IF @cou > 85
BEGIN
INSERT INTO child VALUES(@cou, '小兰') END
END 调用存储过程:EXEC dbo.chjj '李厚鑫s'
sql存储过程怎么接收datatable作为入参
要么生,要么死