J is correct.
As for SQL, the old one will work too for this particular case:
declare @I int
select @I = (select count(convert(varchar(2),ID)+Keyvalue) from #new
group by (convert(varchar(2),ID)+Keyvalue)
having count(convert(varchar(2),ID)+Keyvalue) >1)
set @I = @I-1
set rowcount @I
delete #New where convert(varchar(2),ID)+Keyvalue
in
(select convert(varchar(2),ID)+Keyvalue from #new
group by (convert(varchar(2),ID)+Keyvalue)
having count(convert(varchar(2),ID)+Keyvalue) >1)
Regards,Yelena Varsha