T-SQL find duplicate records

April 4, 2011

Find duplicate records in a table

SELECT
    MyColumn, 
    COUNT(MyColumn) AS Num
FROM MyTable
GROUP BY MyColumn
HAVING ( COUNT(MyColumn) > 1 )