可以用
select distinct * into 临时表 from 表1
这样 临时表 中就是不重复的了,然后再把 临时表 中的数据插入到表1中就可以了.

解决方案 »

  1.   

    TRY:
    Create Table test(tid int identity(1,1),tstr varchar(5))
    Insert into test Select 'texta' Union All
    Select 'textb' Union All
    Select 'texta' Union All
    Select 'textb'Select * From testDelete a From test a left outer join test b on a.tstr=b.tstr Where a.tid>b.tidSelect * From testDrop Table test/*
    tid         tstr  
    ----------- ----- 
    1           texta
    2           textb
    3           texta
    4           textb(所影响的行数为 4 行)
    tid         tstr  
    ----------- ----- 
    1           texta
    2           textb(所影响的行数为 2 行)
    */