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
from Student
)
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.
No comments:
Post a Comment