hi..
use the following query in order to sort out the problem....
it will works even at the time whan all the columns of the table replicates...
Declare @temp table(
id int,
name varchar(10)
)
Insert into @temp (id,name)
select 1,'A'
union
select 2,'B'
union
select 1,'A'
union
select 3,'C'
union
select 2,'B'
Insert into @temp (id,name)
select 1,'A'
union
select 2,'B'
union
select 1,'A'
union
select 3,'C'
union
select 2,'B'
Select * from @temp;
with cust as (
select Row_Number() over (partition by id,name order by id,name ) as rcnt,
id,name from @temp
)delete from cust where rcnt>1;
select * from @temp order by id
Sourabh07
Sqldev, if this helps please login to Mark As Answer. | Alert Moderator