FOREIGN KEY constraint

  • Hi everyone,

    I am getting a FOREIGN KEY constraint error when I try to insert records into a table, I'm not sure I understand why I'm getting the error. It appears to me that the corresponding records exist in the reference table. Can anyone give me hand? How should I troubleshoot this, and most importantly, how do I fix it?

    Thanks,

  • What are the key field data types. Sometimes when you have a char field, a trailing space in the parent record PK can throw someone for a loop? Can you provide any more details?

  • the key field data type is smallint, and I am migrating it (inserting) into a smallint field.

    Here's the error message:

    %ls statement conflicted with %ls %ls constraint '%.*ls'. The conflict occurred in database '%.*ls', table '%.*ls'%ls%.*ls%ls.

    Thanks,

  • can you post the results of:

    sp_helpconstraint 'name_of_constraint'

    as well as an sp_help 'name_of_parent_table'

    and sp_help 'name_of_child_table'

    Thanks.

Viewing 4 posts - 1 through 3 (of 3 total)

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