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 |
|
ravilobo
Master Smack Fu Yak Hacker
1184 Posts |
Posted - 2004-01-14 : 01:12:42
|
| I need to delete some records from a table.This table have many other tables depend on it. And the chain continues...Hence i need to delete the records from the bottom most table and go one step up ...continue till the top table.This is also called as cascading. And can be done with cascading option at the table definition.How to do this programatically at run time?Thank you.------------------------I think, therefore I am |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2004-01-14 : 04:53:48
|
| In SQL2000...it is built in....In SQL 7....you have to handle it yourself.search here for cascade!!! |
 |
|
|
rihardh
Constraint Violating Yak Guru
307 Posts |
Posted - 2004-01-14 : 05:32:41
|
| You could use ON DELETE triggers to do the job. |
 |
|
|
ravilobo
Master Smack Fu Yak Hacker
1184 Posts |
Posted - 2004-01-14 : 06:32:34
|
| How to identify the dependant tables programatically?------------------------I think, therefore I am |
 |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2004-01-14 : 07:23:58
|
| Lookup the information_schema views.....in particular those with regard to constraints + foreign keys....using this route however you are dependant on the database having all appropriate FK's + Constraints defined.....AS THEY SHOULD BE ANYWAY.Search here for information_schema....there are examples of code that will get you moving. |
 |
|
|
|
|
|