我继续收到此错误:
Object '%s' cannot be renamed because the object participates in enforced dependencies
我需要找到一个脚本来帮助我找到该表的所有依赖项。我需要删除它们,重命名,然后将它们带回来。
SQL 服务器 2005
我继续收到此错误:
Object '%s' cannot be renamed because the object participates in enforced dependencies
我需要找到一个脚本来帮助我找到该表的所有依赖项。我需要删除它们,重命名,然后将它们带回来。
SQL 服务器 2005
禁用所有约束
sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"
go
sp_msforeachtable "ALTER TABLE ? DISABLE TRIGGER all"
go
重新启用
sp_msforeachtable"ALTER TABLE ? CHECK CONSTRAINT all"
go
sp_msforeachtable "ALTER TABLE ? ENABLE TRIGGER all"
go
您应该能够轻松地将其调整为仅一张表。
这篇文章包含我最初为 SQL Server 2000 编写并移植到 2005 的 db 逆向工程脚本。如果您查看执行外键关系的位,您可以了解如何从数据字典中获取依赖项。