且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

多对多自引用表中的 CASCADE 删除

更新时间:2022-12-30 18:45:12

阅读 this 知识库文章,其中包含以下内容...

Read this KB article, which says the following among other things...

您收到此错误消息是因为在 SQL Server 中,表不能在所有级联引用的列表中出现多次由 DELETE 或 UPDATE 语句启动的操作.例如,级联引用操作的树必须只有级联引用操作上特定表的一条路径树.

You receive this error message because in SQL Server, a table cannot appear more than one time in a list of all the cascading referential actions that are started by either a DELETE or an UPDATE statement. For example, the tree of cascading referential actions must only have one path to a particular table on the cascading referential actions tree.

要执行您想要的操作,DISPLAY_TAB_GROUPING 表必须出现两次.我建议您改用实现删除代码的存储过程.

To do what you want, the DISPLAY_TAB_GROUPING table would have to appear twice. I suggest you use a stored proc that implements your delete code instead.