用select Top 1 选择到临时表,清空当前表,再重新初始化自增因子,然后写回!
select 标识列1....等所有你想保存的列 from table1 into tempTable
group by 标识列1..等所有你想保存的列
having count (标识列)>1
--ID除外
delete from table1 where 标识列 in (select 标识列 from tempTable)
insert into table1 (所有列) select 所有列 from tempTable Group by 所有列
select distinct * into 新表 from 表
delete from 表
insert into 表 select * from 新表
drop table 新表