select distinct * into temptable from tablename
go
truncate table tablename
go
insert tablename
select * from temptable
go
drop table temptable
go
go
truncate table tablename
go
insert tablename
select * from temptable
go
drop table temptable
go
假使表中只有name,num2字段
delete a
from #t1 a
where exists(select name,num from #t1 where name=a.name and num=a.num group by name,num having count(*)>1)
delete tablename
go
insert into tablename from select * from #temptable
go
delete tablename
go
insert into tablename from select * from #temptable
go