字段不多的话写一个where语句 判断所有字段相同的不导字段多就建个临时表
把两个表都导进去
删除tableb的内容
再把临时表里的数据用distinct 导入到tableb

解决方案 »

  1.   

    insert into TableB select * from TableA where TableA.主鍵 not in ( select 主鍵 from TableB )
      

  2.   

    我就是不知道怎么写这个WHERE啊,我需要判断其中3个主要字段相同的就不导。
    to:qq2080  这句话只能做到主键这一个字段相同的不导,我要的是3个主要字段完全相同不导。
      

  3.   

    insert into TableB select * from TableA 
    where TableA.主键 not exists (select 主键 from TableB where 主键=TableA.主键)
      

  4.   

    insert into TableB select * from TableA 
    where TableA.主键 not exists (select 主键 from TableB where 主键=TableA.主键)
    and   TableA.字段1 not exists (select 字段1 from TableB where 主键=TableA.主键)
    and   TableA.字段2 not exists (select 字段2 from TableB where 主键=TableA.主键)
    ...
      

  5.   

    select * into #tmp from  tabelA  
    insert into #tmp select * from tabelB  
    truncate tabel tabelA
    insert into tabelA select distinct * from #tmp
    drop table #tmp
    select * form tableA
    这样行不?