[547] The ALTER TABLE statement conflicted with the FOREIGN

[547] The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "Foreign Key Name". The conflict occurred in database "Database Name", table "dbo.tbl_name", column 'id'.

(I've removed actual db / table names)

I have ignored Foreign Keys and compare / upgraded the two databases successfully. As soon as I add foreign keys back in I get the error.

The tables already exist in the destination db, just trying to add all the Foreign Keys back in. Any ideas?
CallScripter Helpdesk

Comments

  • jschwarzjschwarz Posts: 15 Bronze 2
    I had this error also, and found that it was due to the data not being the same in the tables.

    In my case, the source database had records in the table where the "conflict" occured. I synched the data between the tables, and then added the FK and that did the trick.
  • Thanks for your reply, but both the source & destination tables are empty.

    The data & structure upgrade worked, but as soon as I add the constraints back in it fails.

    I have even deleted the foreign key from the source database and it still fails!
    CallScripter Helpdesk
Sign In or Register to comment.