SQLServer禁用、启用外键约束

SQLServer禁用、启用外键约束

表中含有外键而无法插入数据的解决办法:禁用外键约束

—启用or禁用指定表所有外键约束

alter table PUB_STRU NOCHECK constraint all;
alter table PUB_STRU CHECK constraint all;

–启用or禁用单个…

表中含有外键而无法插入数据的解决办法:禁用外键约束

—启用or禁用指定表所有外键约束

alter table PUB_STRU  NOCHECK constraint all; 
alter table PUB_STRU CHECK constraint all;

–启用or禁用单个外键约束

ALTER TABLE PUB_STRU NOCHECK CONSTRAINT PUBSTRU_FK1;
ALTER TABLE PUB_STRU NOCHECK CONSTRAINT PUBSTRU_FK2;
ALTER TABLE PUB_STRU CHECK CONSTRAINT PUBSTRU_FK1;
ALTER TABLE PUB_STRU CHECK CONSTRAINT PUBSTRU_FK2;

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×