Introduction: In this article I will explain how we can delete duplicate rows from a table in Sql server
In the previous article I have explained how to find duplicate records in a tablein Sql server and count duplicate records of a table in Sql.
I have a table “Student” and have the duplicate records.
We can delete the duplicate records of table using row_number().
with TempTable as
select *, row_number() over (partition by name order by name) as Rank
Delete from TempTable where Rank >1
In the above given example I delete the duplicate records on the basis of duplicate name.
In this article I tried to explain Sql server : delete duplicate rows from a table in Sql server. I hope you enjoyed this article.
What do you think about this article?
If you found this article useful, please share and follow on Facebook, Twitter, Google Plus and other social media websites. To get free updates subscribe to newsletter. Please put your thoughts and feedback in comments section.