如何解决当您有两个相互冲突的表时,请使用表强制删除
我创建了表A
和表B
Msg 3726,Level 16,State 1,Line 4 Could not drop object 'a' because it is referenced by a FOREIGN KEY constraint. Msg 3726,Line 5 Could not drop object 'b' because it is referenced by a FOREIGN KEY constraint.
CREATE TABLE a (
no INT IDENTITY(0,1) NOT NULL,aaa NVARCHAR(4000) NOT NULL,);
CREATE TABLE b(
no INT IDENTITY(0,bbb NVARCHAR(4000) NOT NULL,);
这些是我对这些表的参考约束
ALTER TABLE a ADD FOREIGN KEY (no) REFERENCES b(no);
ALTER TABLE b ADD FOREIGN KEY (no) a(no);
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE a;
DROP TABLE b;
SET FOREIGN_KEY_CHECKS = 1;
DROP TABLE ENERGY.D_CORROSION_COUNT_1 CASCADE CONSTRAINTS PURGE;
DROP TABLE ENERGY.D_CORROSION_COUNT_2 CASCADE CONSTRAINTS PURGE;
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。