更新时间:2023-02-04 10:06:42
找到一种排序方法,虽然我不明白为什么它是必要的。 >
已经能够通过首先禁用约束来删除约束:
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