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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 cascading deletes

Author  Topic 

sql777
Constraint Violating Yak Guru

314 Posts

Posted - 2004-12-17 : 14:29:33
Hi,
I'm having some issues with cascading deletes.
I have a table which contains the PK, and I obviusly cannot delete that row until I delete all the child tables.

So I am doing:

delete table_a
where myid = @myid

delete table_b
where myid = @myid


-- i need to loop through all call this sproc x number of times...passing it some ids

-- get all the ids from table_abc and then call this sproc

exec mysproc @someotherID -- <------------------------------??


-- pk table
delete table_PK
where myid = @myid

Hippi
Yak Posting Veteran

63 Posts

Posted - 2004-12-17 : 14:53:50
Maybe I don't understand your question but in SQL 2000, it supports cascade delete or you may use a trigger to do it.
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2004-12-17 : 14:58:53
There's also:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=14594
Go to Top of Page
   

- Advertisement -