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 |
|
rammohan
Posting Yak Master
212 Posts |
Posted - 2008-08-08 : 07:51:41
|
| Dear All, I Have Two Tables:table1:id primary keynametable2:id1id references table1(id)details.now i have 10 records in each table. how can i set the ondelete cascade for id column.if i delete id in table1, the records with id in table2 should automatically deleted. please tell me how to set ondelete cascade in this situationOne can never consent to creep,when one feels an impulse to soarRAMMOHAN |
|
|
NeilG
Aged Yak Warrior
530 Posts |
Posted - 2008-08-08 : 07:59:14
|
| Just add the on delete cascade command at the end of the foreign key i.eCONSTRAINT FK_TABLE1_TABLE2 FOREIGN KEY (ID) REFERENCES TABLE1 (ID) ON DELETE CASCADE***************************Life is for having Fun, and then a little work |
 |
|
|
|
|
|