时间:2021-07-01 10:21:17 帮助过:3人阅读
查询出开启所有外键约束的语句,与上面的区别是将 NOCHECK 改为 CHECK
SELECT ‘ALTER TABLE ‘ + O.NAME + ‘ CHECK CONSTRAINT [‘ + F.NAME + ‘];‘ AS COMMAND FROM SYS.FOREIGN_KEYS F INNER JOIN SYS.ALL_OBJECTS O ON F.PARENT_OBJECT_ID = O.OBJECT_ID WHERE O.TYPE = ‘U‘ AND F.TYPE = ‘F‘;
Sql Server有主外键关系时添加、删除数据
标签:foreign check from 删除 select pre key comm ble