Tuesday, 30 September 2014

How to delete duplicate row from database table in Sql server

(1) select * from student
 duplicate row in table

 

(2)select ROW_NUMBER() over(partition by name order by name) R
,name,dob from student
R is Row number



(3)delete q from(select ROW_NUMBER() over(partition by name order by name) R
,name,dob from student)q where R>1
(4)After delete command table look like.


Refrence Link

No comments:

Post a Comment