SQLTeam.com | Weblogs | Forums

Copying data from Temp Tables to Main Tables using "Cursor" in same Database


I have data in 4 temp tables. I need to copy into 6 main tables from the same Database
after inserting 1 row into 1st main table, then i need to capture that Identity column from 1st main table and need to insert into 2nd Main table and the identity column from the 2nd Main table to 3rd Main table.
can you guys help me how to do with "Cursors" or is there any other way to use like SSIS or sql server integration services. Please advise.


From the information provided, it sounds as though you should keep it set based and use the OUTPUT clause: