Counter of Festivals

Ashok Blog for SQL Learners and Beginners and Experts

Wednesday 11 December 2013

Duplicate removal in Table

T-SQL:

with a
as
(
select * from ( select row_number() over(partition by emp_id order by emp_id)[dup],* from Employee_Test)[samp]
)
delete from a where [dup]>1-------->to remove
--select * from a where [dup]>1----> to see 

No comments:

Post a Comment