Foreign Key constriant

  • Hi,

       iam getting this message,any suggestions how i can fix it

    The INSERT statement conflicted with the FOREIGN KEY constraint "FK_FM_Building_Cost_AP_List". The conflict occurred in database "Systems", table "dbo.AP_List ", column 'Building_Id'.

    The statement has been terminated.

  • Reads to me like you have a FK on one of your columns which is constrained to another tables key column which does not have a matching value. You will either need to remove/disable the constraint or better add a value to the constraining table to make your insert valid.

  • Read up in BOL on how foreign key constraints work?

    You're trying to do an insert to a table and violating the constraint listed there on the Building_Id column. Make sure that any values you are inserting which are dependent upon key values in other tables are actually valid... either you have to seed appropriate values into the primary table or change what you're inserting.

  • Seriously?  This is a 5 second search in BOL to get the answer to your question.  I am not trying to be mean, but do you even search BOL or Google before posting here, or is it straight from the error window into a post?

    I tend to learn a lot more researching my own problems before I bring them to others.

  • Personally, I don't think he knows how to read BOL.

     

  • I really thought you were going to stop that sentence at read

  • If that was the case, how would this forum help him?

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply