Delete duplicate records using this script in MS Sql Server
Hi Friends , You can delete duplicate records using this script in MS Sql Server. I write a example below. Declare @tblEmployee As table ( Eid int, Ename varchar(10) ) insert into @tblEmployee values(1,'A') insert into @tblEmployee values(2,'B') insert into @tblEmployee values(3,'A') insert into @tblEmployee values(4,'D') insert into @tblEmployee values(5,'B') Select * from @tblEmployee Delete From @tblEmployee Where Eid in ( Select Eid from (Select * , ROW_NUMBER() Over ( partition by Ename Order by Ename ) As ICount From @tblEmployee )As Qry Where Qry.ICount > 1 ) Select * from @tblEmployee