Ran into a wall here and need some input.
--@my_Table_ids is a user defined table type that is a list of PK's
--This INSERT works just fine
INSERT INTO dbo.MyMainTable
(MyMainField)
SELECT
MyMainField
FROM dbo.MyMainTable_TEMP WHERE MY_PK IN (SELECT id FROM @my_Table_ids)
--Now, I need the new list of PK's that were created
--above and update another table that which
--also contains the list @my_Table_ids
--NOT SURE ABOUT THIS UPDATE for the WHERE clause
UPDATE MyXTable SET
MY_MyMainTable_FK = (SELECT MY_PK FROM dbo.MyMainTable WHERE)
WHERE MyTempFK IN (SELECT id FROM @my_Table_ids)
The Update is what I think may work but need a second opinion.
Thanks!