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
 General SQL Server Forums
 New to SQL Server Programming
 Deleting related records.

Author  Topic 

BendJoe
Posting Yak Master

128 Posts

Posted - 2007-10-17 : 11:24:22
Hi
I wanted to do a delete rows from a group of table. These tables have a common column UserID. I heard that there is something called ondelete cascade. But I don't know how to set it up and utilise it. Could someone tell me how to do it. Or point me to a tutorial which shows how to do it.
Thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-10-17 : 11:36:05
You set this behaviour when you add the foreign key constraint.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2007-10-17 : 11:37:35
Danger...Danger Wil Robinson

Do you know what Books Online is?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

BendJoe
Posting Yak Master

128 Posts

Posted - 2007-10-17 : 11:48:12
quote:
Originally posted by Peso

You set this behaviour when you add the foreign key constraint.



E 12°55'05.25"
N 56°04'39.16"




Is this cascaded deletion a two way process, If you try to delete a row in the foriegn key table will it delete the row in the primary key table?
Thanks
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-10-17 : 11:52:12
No.
Read Books Online as suggested to you.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -