日期:2014-05-17 浏览次数:20397 次
-------------如果删除的数据量比较大时 With dup as ( Select *,ROW_NUMBER() Over(Partition by a,b order by a,b)as rn From dbo.tb ) Select a,b Into dbo.duptmp From dup Where rn = 1; --- drop table tb; exec sp_rename 'dbo.duptmp','dbo.tb'
Quote: 引用: 1、select distinct a,b into #t from tb 2、truncate table tb 3、insert into tb select * from #t 能不能解说下原理? 新手不大懂
1、select distinct a,b into #t from tb 2、truncate table tb 3、insert into tb select * from #t