-- 4 ways to get identity IDs of inserted rows in SQL Server
INSERT INTO TableA (...) VALUES (...)
SET @LASTID = @@IDENTITY
INSERT INTO TableA (...) VALUES (...)
SET @LASTID = SCOPE_IDENTITY()
SET @LASTID = IDENT_CURRENT('dbo.TableA')
DECLARE @NewIds TABLE(ID INT, ...)
INSERT INTO TableA (...)
OUTPUT Inserted.ID, ... INTO @NewIds
SELECT ...