I would like to insert into a TempTable the inserted column value, which I have working, as well as a column from the original select all in one shot. Is this possible?
This works where a is the PK that is auto-generated and b and c are other columns.
INSERT INTO App.Table1 (b, c)
OUTPUT inserted.a INTO #TempTable
SELECT b, c
FROM App.Table2
Can I do something like:
INSERT INTO App.Table1 (b, c)
OUTPUT t2.a, inserted.a INTO #TempTable
SELECT b, c, a
FROM App.Table2 t2
Effectively I want a #TempTable that has the original PK of the row and the new PK so I have a lookup table essentially.
OUTPUTclause can only return values from theinsertedanddeletedpseudo tables.