I am inserted a row from A to B. I am trying to populate a temporary table with the id of created rows and original rows
DECLARE @Ids TABLE ([OldId] INT, [NewId] Int)
INSERT INTO B
(code,
type)
OUTPUT NULL,insterted.ID into @Ids
Select @NewCode, type
From A
Where code = @OldCode
I can get the inserted rows ids via the insterted
token, but not the origin.
How can i build this Ids table, either using or not the OUTPUT
token ?