Eliminate Duplicates

This will find and delete all duplicate rows. You can refine the granularity of uniqueness by including more columns than just the Primary Key. If you are picky about which rows you want to delete, don't use this. Instead use the 'Find Duplicates' script I just submitted and then delete manually.

2002-05-24

1,080 reads

Find Duplicates

Find duplicates in any table, and report the number of duplicates. Enter in the table name, and the field or fieldsfor which there should only be one row for each of that field, but you suspect are more. For example, if an employee table has more than one record for an employeethis will find any […]

5 (1)

2002-05-24

569 reads

TableCounts

This script generates a statement that you would then run in the user database to get rowcounts of all tables. The advantages of this approach are you can modify it to get just the tables you want, and the output is easy to read:Table1-------1069Table2------10427

2002-05-24

405 reads

Blogs

How I passed the 70-761 certification exam

By

FUN FACT: I have been a Microsoft Certified Professional for SQL Server for over...

Azure Storage tips

By

As a followup to my blog post Azure Data Lake Store Gen2 is GA,...

Managing Agent Jobs on Availability Group Servers

By

As always, the scripts in this post can also be found on our Git...

Read the latest Blogs

Forums

SQL Server Availability Groups, Readable Secondary Backups and Log Chains

By WoundedParrot

Hi all Bit if an unusual one here, and you’ll have to forgive me...

I need to move database with 500 tables from SQL Server to Oracle 19

By VoldemarG

I have a SQL Server database,  that I need to migrate to Oracle 19....

I need to move database with 500 tables from SQL Server to Oracle 19

By VoldemarG

I have a SQL 2014 database, and two more from 2016, that I need...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers