xxxxxxxxxx
CREATE TABLE #a(identity_column INT IDENTITY(1,1), x CHAR(1));
INSERT #a(x) VALUES('a');
SELECT SCOPE_IDENTITY();
-- 4 ways to get identity IDs of inserted rows in SQL Server
INSERT INTO TableA ( ) VALUES ( )
SELECT @@IDENTITY
INSERT INTO TableA ( ) VALUES ( )
SELECT SCOPE_IDENTITY()
SELECT IDENT_CURRENT('dbo.TableA')
DECLARE @NewIds TABLE(ID INT, )
INSERT INTO TableA ( )
OUTPUT Inserted.ID, INTO @NewIds
SELECT