SQL删除外键约束

  

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

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

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

1 alter table 表名 drop constraint 外键约束名

转载于:https://my.oschina.net/weisenz/blog/200655

猜你喜欢

转载自blog.csdn.net/weixin_34237596/article/details/91920860