且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

INSERT 语句与 FOREIGN KEY 约束冲突 - SQL Server

更新时间:2023-02-25 22:03:46

在您的表 dbo.Sup_Item_Cat 中,它有一个指向另一个表的外键引用.FK 的工作方式是,它不能在该列中具有不在引用表的主键列中的值.

In your table dbo.Sup_Item_Cat, it has a foreign key reference to another table. The way a FK works is it cannot have a value in that column that is not also in the primary key column of the referenced table.

如果您有 SQL Server Management Studio,请打开它并sp_help 'dbo.Sup_Item_Cat'.查看 FK 位于哪一列,以及它引用哪个表的哪一列.您插入了一些错误数据.

If you have SQL Server Management Studio, open it up and sp_help 'dbo.Sup_Item_Cat'. See which column that FK is on, and which column of which table it references. You're inserting some bad data.

如果您需要更好的解释,请告诉我!

Let me know if you need anything explained better!