Answers for "sqlexception: the insert statement conflicted with the foreign key constraint"

2

sqlexception: the insert statement conflicted with the foreign key constraint

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.

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!
Posted by: Guest on March-03-2021

Code answers related to "sqlexception: the insert statement conflicted with the foreign key constraint"

Browse Popular Code Answers by Language