This short blog shows you how to list the data in duplicated rows in SQL Server.
Let’s look at the Northwind (https://chanmingman.wordpress.com/2012/03/18/northwind-in-microsoft-sql-server-2012/) database in SQL Server. You can see the Shippers table has 2 duplicate rows, United Package.
As first, we find out which rows are duplicated, and how many duplication are there.
Then we list the content of those rows.
SELECT ship.CompanyName, ship.Phone
From [dbo].[Shippers] ship
SELECT CompanyName, Phone,
by CompanyName, Phone
as ship1 on
ship.CompanyName = ship1.CompanyName
AND ship.Phone = ship1.Phone