且构网

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

MS SQL 中的自引用约束

更新时间:2023-02-02 22:28:14

存在无法在具有自引用约束的表上设置 ON DELETE CASCADE 的情况.存在循环逻辑问题的可能性,因此不允许.

It is the case that you cannot set up ON DELETE CASCADE on a table with self-referencing constraints. There is a potential of cyclical logic problems, hence it won't allow it.

有一篇很好的文章这里 - 不过它适用于 SQL 的第 8 版而不是第 9 版 - 尽管适用相同的规则.

There's a good article here - though it's for version 8 rather than 9 of SQL - though the same rules apply.