select * into #temp from table0--你的原始表名
where 1=2
insert into #temp select distinct * from table0
delete table0
insert into table0 select * from #temp
drop table #temp
和
to longji(龙寂) :
‘ select * into #temp from table0--你的原始表名
where 1=2
insert into #temp select distinct * from table0 ’
能不能写成: select distinct * into #temp from table0 ?
可以写成select distinct * into #temp from table0
但我想可能相对来说,前面那样写会快一些,当然用truncate table0 的删除速度更快
' select identity(int,1,1) as T,* into #temp from yourtable
delete yourtable where id not in(select F,id from #temp group by F,id )
drop #temp ' 能不能注释下,我是初学者,看不太懂。 谢谢
select * into #temp from table0--你的原始表名
where 1=2
insert into #temp select distinct * from table0
delete table0
insert into table0 select * from #temp
drop table #temp