没有好的办法:    select * into #temp from A
    insert #temp select * from B    select distinct * from A
    select distinct * from #temp如果上面两条返回的记录数相同, 则AB表完全相同,否则不完全相同

解决方案 »

  1.   


    Select t1.编号 as 相同的编码
    From table1 as t1 Inner Join
    table1 as t2 On t1.编号=t2.编号
    and t1.字段2=t2.字段2 and ..........
      

  2.   

    select a.id,a.字段1,b.字段1,……
    fom a inner join b
    on a.id=b.id
    where replace(a.字段1,b.字段1,'')<>''
    or ……
      

  3.   

    --这样可能更清楚些select a.id
    ,a.字段1=case when a.字段1<>b.字段1 then a.字段1 else '' end
    ,b.字段1=case when a.字段1<>b.字段1 then b.字段1 else '' end
    ,……
    fom a inner join b
    on a.id=b.id
    where replace(a.字段1,b.字段1,'')<>''
    or ……