How to detect duplicate rows in a SQL Server table?

What is the most efficient way to detect duplicates in a 10 column / 50K row table? I'm using MSSQL 8.0

Answers


To show an example of what others have been describing:

SELECT
    Col1, -- All of the columns you want to dedupe on
    Col2, -- which is not neccesarily all of the columns
    Col3, -- in the table
    Col4,
    Col5,
    Col6,
    Col7,
    Col8,
    Col9,
    Col10
FROM
    MyTable
GROUP BY
    Col1,
    Col2,
    Col3,
    Col4,
    Col5,
    Col6,
    Col7,
    Col8,
    Col9,
    Col10
HAVING
    COUNT(*) > 1

Need Your Help

Layering components with QT

qt qt-creator

I am using QT Creator to develop a small GUI app. I have a GraphicsView component which spans the entire window. My question is, how can I place other widgets (such as transparent buttons) ontop of...

Friendly URLs spaces to hyphens & uppercase to lowercase

php regex apache .htaccess mod-rewrite

I'd like to convert spaces in dynamic URLs to use hyphens, and if there are any uppercase letters in the URL then it would make them lowercase.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.