Various way of finding duplicate rows in SQL Server

Recently One of the friend ask how we can find duplicate rows in SQL server so I said there are various way of finding duplicates and then I show him few ways of findings duplicate based on criteria. I thought it is a very basic question and still lots of people does not know how to find duplicate rows in SQL Server. So it is good idea to write blog post about it. In this blog post I’m going to explain the same various way of finding duplicates.

First all, We need a table to find duplicate rows. So following is a table for that.I have created Employee table with four fields.

CREATE TABLE [dbo].[Employee](
    [Id] [int] NOT NULL,
    [FirstName] [nvarchar](50) NULL,
    [LastName] [nvarchar](50) NULL,
    [Designation] [nvarchar](50) NULL
) ON [PRIMARY]

Now once you create this “Employee” table now it’s time to write insert data. I have inserted following data.

Find-Duplicate-Row-SQL-Server

More on my personal blog @ http://www.dotnetjalps.com

Shout it
Published Saturday, January 18, 2014 11:34 AM by Jalpesh P. Vadgama
Filed under:

Comments

# re: Various way of finding duplicate rows in SQL Server

Saturday, January 18, 2014 4:03 AM by Seyed Morteza Mousavi

Thanks but, I did not get it? Where is your solution to this problem?