能否将excel中的重复记录过滤掉,然后再导入到SQL SERVER

解决方案 »

  1.   

    可以先导入,然后在删除重复的记录
    select distinct * into #t from 原表
    begin tran
     delete from 原表
     insert 原表 select * from #t
    commit tran
    drop table #t
      

  2.   


    --该表须没有自增字段才可以!
    alter table tablename add fid int identity(1,1)
    delete tablename where fid not in (select min(fid) from tablename group by 字段1,
    字段2,字段3,字段4......所有字段列上)
    alter table tablename drop column fid
    2、
    select distinct * into #temp from tablename 
    delete tablename 
    go
    insert tablename select * from #temp
    go
    drop table #temp