开发者

Self referencing Foreign Key SQL Server DeleteAction does nto work

I have one Table with a self referencing foreign key with DeleteAction set to Cascade, but when Parent is deleted,no children (direct or descendant) does not delete.

What a开发者_JAVA百科m I missing ?


You cannot use cascade delete on self referencing tables.

Check this link for possible solution.


For use delete cascade use following Create table script...

CREATE TABLE

test_child

( SUB1 INT, [NO] int, FOREIGN KEY ([NO]) REFERENCES Test_parent ON DELETE CASCADE )

Check This link for more information:

http://msdn.microsoft.com/en-us/library/ms186973.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜