Error message:
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint. The conflict occurred in database , table , column
Explanation:
Some foreign values do not exist in primary table.
Solution:
Make your table empty, or add the associated value to the primary key table.
A query to find the missing values:
SELECT F.* FROM ForeignTableName F
LEFT JOIN PrimaryTableName P on F.FKcolumn = P.PKcolumn
WHERE P.PKcolumn is null
thank you
ReplyDeleteI would not have thought of this for a few hours or days :)
thank you
ReplyDeleteI would not have thought of this for a few hours or days :)
Thanks a lot for the query, you are the boss.
ReplyDelete