How to identify duplicate records in sql server

Very common issue is duplicated records that prevent creating index on table. We can use this simple query for identify them:

SELECT *
     FROM table
        WHERE (column IN (SELECT column
                               FROM table
                                  GROUP BY column
                                      HAVING (COUNT(*) > 1))) ;
Advertisements