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 delete using query

Author  Topic 

sqlhunter123
Starting Member

2 Posts

Posted - 2008-01-14 : 08:44:44
Hi All,

I have two tables A and B. These are related using a foreign Key. The 'Delete cascade' option is not set in this relation. IS there any way to force delete cascade in delete query using sql?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-01-14 : 10:25:03
One method is to write a DELETE trigger which will delete the matching records from child tables.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-01-16 : 03:32:23
or

ALTER TABLE master_table NOCHECK CONSTRAINT ALL
delete from master_table where.....
delete from child_table where.....
ALTER TABLE master_table CHECK CONSTRAINT ALL



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -