SQl Server code to remove duplicates from the table

Posted by Manojjupally under Sql Server category on | Points: 40 | Views : 934
Remove duplicate rows

select * from temp1

declare @duplikate table (ID int NOT NULL,Name varchar,Age int,city varchar);

with duplikate as (
SELECT ID,Name,Age,city,
row_Number () Over (partition by Name,Age,city order by Name)
as RowNumber
FROM Temp1
delete from duplikate where RowNumber >=2

Comments or Responses

Login to post response