Delete duplicate Records

  • Is it possible to delete duplicate records in single query without using cursors and table is not having any unique constraiant field? If yes please give the query.

    Thanks in advance..

    Regards:

    Narendra Babu A

  • - one way of doing this would be to select distinct(field name) into another table..

    but it would help to have more details on your table with duplicates!!!







    **ASCII stupid question, get a stupid ANSI !!!**

  • Not that I know of.

  • You don't necessarily need a unique constraint... how else would you have dupes?  But you do need to identify what you want to be unique when the dupes are removed.  Think of it as if you were to add a unique constraint to prevent dupes, what would it be?  That will identify the columns to write the duplicate deletion script on... there's several ways to delete dupes but first you must identfy what identifies a dupe.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

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

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