Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在关闭约束检查的批量加载后,我在外键列中有一些记录要删除,因为它们违反了约束。DBCC 很好地表明了它们,但是有没有一种简单的方法来获得这个 [colARef] = 'XXX' DBCC 表示法的违规值?我的意思是不解析它,获取能够查找主键然后删除的值。 谢谢
根本不查看 DBCC 输出,您可以发现约束违规,例如:
select * from ReferencingTable t1 where not exists ( select * from ReferencedTable t2 where t1.ForeignKeyColumn = t2.Id )