Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sujosh
Yak Posting Veteran
55 Posts |
Posted - 2005-06-28 : 17:56:01
|
| I need to retrieve records from Table A ( from Oracle) into a temp table and then insert into TAble B/ Table C (master detail into SQl Server DB).Then for each record inserted in Table C, I have to populate Table D,E and F. I am just oign to use three table to define what I am looking for1) Select * from Table A2) Insert this into a TEmp table3) Loop through the temp table 4) For each record in Temp table5) Create a record in Table B(SQl Server)6) Get the PK from newly inserted row in Table B7) Use that PK as the FK and insert into TAble C8) Continue looping till end of row in the Temp tableCould someone please give me an idea as to how this SP should look like? Can this be done in DTS? Which option is better. I have written SP but not like this kind.Thanks much! |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2005-06-28 : 22:30:29
|
| Get rid of the loop.Insert entire temp table into TableBINNER JOIN temp table to TableB and insert resulting SELECT into TableCIf you want more help, read this:http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxThat will help you get answers faster on pretty much any forum out there.MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
|
|
|