sql server 刪除外鍵約束

使用以下SQL語句查詢出表中外鍵約束名稱:code

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語句刪除便可。blog

1 alter table 表名 drop constraint 外鍵約束名
相關文章
相關標籤/搜索