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 |
|
rjhe22
Constraint Violating Yak Guru
283 Posts |
Posted - 2010-05-21 : 10:29:23
|
| hii have a table called bankstatements that using referential integrity and is linked to a few other tables and i have to come up with sql to puge the table for cetain bankidany ideas on the best way to do this |
|
|
lazerath
Constraint Violating Yak Guru
343 Posts |
Posted - 2010-05-21 : 10:39:54
|
| If your Foreign keys are setup to CASCADE on DELETE, then you can create a simple stored procedure to delete the entry out of bankstatements and it will handle the related rows.Otherwise, you'll have to script all the deletes for each related table. Start with the leaf level tables and delete the data out of there, working your way backward so the last statement deletes the entry out of bankstatements. |
 |
|
|
rjhe22
Constraint Violating Yak Guru
283 Posts |
Posted - 2010-05-21 : 10:43:57
|
| no they are not set up as cascade which is a pity now |
 |
|
|
|
|
|