lar-variable)
DECLARE @id int INSERT INTO MyTable(name) OUTPUT @id = Inserted.id VALUES('XYZ')
我正在尝试以上。这怎么可能?
使用表变量获取ID
DECLARE @id int DECLARE @table table (id int) INSERT INTO MyTable(name) OUTPUT inserted.id into @table VALUES('XYZ') SELECT @id = id from @table