Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2004
    Posts
    7

    Cool Unanswered: Deleting duplicate records

    Hi All,
    I am having one table named MyTable and this table contains only one column MyCol. Now i m having 10 records in it and all the records are duplicate ie value is 7 for all 10 records.

    It is something like this,

    MyCol
    7
    7
    7
    7
    7
    7
    7
    7
    7
    7

    Now i m trying to delete 10th record or any record then it gives me error
    "Key column information is insufficient or incorrect. Too many rows were affected by update."

    What should i do if i want only 4 records insted 10 records in my table?
    How do i delete the 6 records from table?

    Plz help me.


    Regards,
    Shailesh

  2. #2
    Join Date
    Feb 2004
    Posts
    492
    Since there seems to be no (primary) key to identity the row there's nothing left than a workaround, which basically will delete all rows with, in this case, mycol on 7, and inserts four (your case) new records with the value 7.

  3. #3
    Join Date
    Aug 2002
    Location
    Prague
    Posts
    77
    this could work for you:

    set rowcount 4

    delete from table_name

    set rowcount 0 --set back to affect all rows


    mojza

  4. #4
    Join Date
    Jun 2004
    Posts
    57
    Hi,
    you can also temporary add one identity column and delete all the record that you dont need. After finish drop the new added identity column.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •