locked
Foriegn Key Conflict with old deleted table RRS feed

  • Question

  • User116643834 posted

    I design the database for a Small App Project. So i create tables such as tblogin, tbloginType,tbContent and make relationships. Then I recreate the same tables with different name such as tb_login, tb_loginType and give relationship. I delete the tables (tbloginType, tbContent) by right click and delete option byt NOT able to delete the table tblogin. Now when i enter the values in the table tb_Content i got the Error Message "Conflict with the FORIEGN KEY tblogin". please answer me the Solution to over come this issue in SQL Server 2008 R2

    Wednesday, June 1, 2016 9:21 AM

Answers

  • User-2057865890 posted

    Hi harichennai,

    To avoid this error from happening, make sure that the value you are inserting into a column that references another table exists in that table.  If the value does not exist in the primary table, insert to that table first before doing the insert on the second table.

    Best Regards,

    Chris

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 3, 2016 3:26 PM

All replies

  • User77042963 posted

    Remove the foreign key from the table first and check your data in these tables and recreate foreign key relationship after you fix your data in both tables.

    Wednesday, June 1, 2016 1:55 PM
  • User-2057865890 posted

    Hi harichennai,

    To avoid this error from happening, make sure that the value you are inserting into a column that references another table exists in that table.  If the value does not exist in the primary table, insert to that table first before doing the insert on the second table.

    Best Regards,

    Chris

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 3, 2016 3:26 PM