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 |
|
Vivaldi
Constraint Violating Yak Guru
298 Posts |
Posted - 2001-07-26 : 07:48:26
|
| Well Sql Jedi's,I have a Basic Question.I have three tables.Table1id | nameTable2id |table1.id|nameTable3id | table2.id | name2 relates to 1, 3 relates to 2.I am writing a stored proc to run the copy based on Table1's ID. Then "cascade" through all the applicable records in table2 and the applicable records in table3.I basically just want to select the data out of the table, alter it a little (add some text) and re insert it into the same table as a "copy") for each record that relates to the ID passed in.My thoughts are filled with lots of cursors.[In pseudo]Select Table1 REcord into cursorInsert Copy of Table1Select TAble2 records for table1.id with cursorinsert within loop.... same for table3. IS There a BETTER way?Composing temporary solutions to permanent problems |
|
|
|
|
|