I need to perform a Bulk Insert from 3 tables into 3 other tables. However my problem is that Once Insert rows into the first table I need to get the ID as its the Foriegn key for the other 2 tables
DB1 - TableA, TableB, TableC
If it was just one table I would simply do
Insert INTO DB1.dbo.TableA(column1,column2....)
SELECT column1,column2.. FROM DB2.TableA
This works for one table.... but with the other 2 tables the foriegn key changes when rows are inserted into TableA.
How can I get the New ID value as we insert a single row and then insert data into the other 2 tabels.