cant insert a row due to identity column

  • i have a

    table with a uniqueidentifier column. i want to insert a row into that table,

    so i copied a row

    from that table into a temp table, altered the primary key to be individual

    and

    also altered the uniqueid column using the newid() function, but i still get an error

    :

    Msg 2627

    , Level 14, State 2, Line 3

    Violation of UNIQUE KEY constraint 'IX_MainTable_bla_bla'. Cannot insert duplicate key in object 'MainTable'.

    The statement has been terminated

    .

     

    how do i

    insert this row into my table and get rid of this error?

  • James,

    The error suggests that you might have another column (in addition to the primary key column) that has a unique constraint on it.

    Run sp_help against the table and check out what column(s) the constraint IX_MainTable_bla_bla is bound to.

  • yea, i did. thanks for the tip. once i added a value, that matched the value of the parent row it inserted fine. thanks

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

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