无法删除sql server 2005中的约束“”无法删除约束。参见先前的错误“ [英] Unable to drop constraint in sql server 2005 "Could not drop constraint. See previous errors"
本文介绍了无法删除sql server 2005中的约束“”无法删除约束。参见先前的错误“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图删除数据库表上的约束,例如:
ALTER TABLE MyTable删除CONSTRAINT FK_MyTable_AnotherTable
但是执行只是运行和运行。如果我停止它,我看到:
消息3727,级别16,状态0,行2
无法删除约束。查看以前的错误。
Web搜索会抛出各种页面,但是注意约束被正确命名,使用正确的名称
解决方案
找到一种排序方法,虽然我不明白为什么它是必要的。 >
已经能够通过首先禁用约束来删除约束:
ALTER MyTable NOCHECK CONSTRAINT FK_MyTable_AnotherTable
下落然后完成
仍然欢迎对必要原因的任何意见
I'm trying to drop a constraint on a db table, something like:
ALTER TABLE MyTable drop CONSTRAINT FK_MyTable_AnotherTable
But the execution just runs and runs. If I stop it I see:
Msg 3727, Level 16, State 0, Line 2
Could not drop constraint. See previous errors.
Web search throws up various pages but note that the constraint is properly named and I am trying to remove it using the correct name
解决方案
Found a way to sort this, although I don't understand why it was necessary.
Have been able to drop the constraint by disabling it first:
ALTER MyTable NOCHECK CONSTRAINT FK_MyTable_AnotherTable
The drop then completes fine
Would still welcome any comments on the reason why this is necessary
这篇关于无法删除sql server 2005中的约束“”无法删除约束。参见先前的错误“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文