Deleting duplicate records

  • HI. I have a table with 2 identical records. I'm trying to delete just 1 of them and i get the following error:

    "Key column information is insufficient or incorrect. Too many rows were affected by the update".

    Can someone tell me how i can get past this error?

    Juanita

  • Without knowing your table structure and the statement you use, this is probably not much than guessing, but I assume you have no column or combination of column to uniquely identify each row in your table.

    The easiest solution might be to temporarily add a unique identifying column (IDENTITY or something like this), get rid of the duplicates, implement a proper table design with a PRIMARY KEY CONSTRAINT and DROP the IDENTITY column.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • Frank,

    Thanks so much. that is a great idea ! i'll give that a try.

  • --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • Thank You for the Solution. It helped me too.

    Smitha

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

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