使用INSERT INTO … SELECT FROM查询时,是否可以检索新插入记录的所有键?
DECLARE @MyVar TABLE ( ID int ) INSERT INTO dbo.TargetTable OUTPUT INSERTED.ID INTO @MyVar SELECT * FROM dbo.SourceTable SELECT * FROM @MyVar