使用如下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数据库删除表的外键约束(INSERT 语句与 FOREIGN KEY 约束"XXX"冲突。该冲突发生于数据库"XXX",表"XXX", column 'XXX)

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

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

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
  • 2021-09-16
  • 2021-12-06
  • 2021-12-06
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-02
  • 2021-07-15
  • 2021-12-02
  • 2022-02-08
相关资源
相似解决方案