sql server 删除外键约束

使用如下SQL语句查询出表中外键约束名称:

select name  
from  sys.foreign_key_columns f join sys.objects o on f.constraint_object_id=o.object_id 
where f.parent_object_id=object_id('表名')

执行如下SQL语句删除即可。

1 alter table 表名 drop constraint 外键约束名
posted @ 2016-12-08 10:33  小蝎莫慌  阅读(1909)  评论(0编辑  收藏  举报