FK constraints...

  • Hi all....I hope you can answer me this...it is driving me crazy!

    I have 2 tables. UserGroup/UserGroupOrg. they have their PK/FK contrainsts set up. They are both empty. I am adding data from another table into the UserGroup table. I am getting an error that says:

    Server: Msg 547, Level 16, State 1, Line 32

    INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'FK_UserGroupOrg_UserGroup'. The conflict occurred in database 'Org', table 'UserGroup', column 'UserGroupID'.

    The statement has been terminated.

    there is no data that it should be referencing in the UserGroupOrg table!! Why am I getting this message?? Please help me understand!!

    as always.......


    Thank you!!,

    Angelindiego

  • I think your foreign key may be backwards.

    It looks like your UserGroups table has an FK to your UserGroupsOrgs table. Does it? If so, that will block the insert.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • thank you! in looking at it to be sure, I realized that the script I was running I had numbered wrong and the fk table was being populated first and therefore flagging the error. I feel stupid over this one!

    thank you for your response, it at least made me check my sp after looking and then I found my mistake...USER ERROR!! LOL...


    Thank you!!,

    Angelindiego

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

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