同意  zjcxc(: 邹建 :) 的看法
要处理需要重新插入!

解决方案 »

  1.   

    补充:1、自增列可以删除后重建
          2、to liuyun2003(流云(快乐的生活在南宁中……))是往现有表增加数据
          3、可以不是一条SQL比如表a如下
    aid,name,aOther
    1   a     pp
    2   b     qq
    表b如下
    bid,name,bOther
    1    b     mm
    2    c     nn那么处理的结果就应该是
    表a
    aid,name,aOther
    1   a     pp
    2   b     qq
    3   c     null表b如下
    bid,name,bOther
    1    a     null
    2    b     mm
    3    c     nn
      

  2.   

    create table #a(aid numeric(5) IDENTITY(1,1) not null,name varchar(8),aOther varchar(8))
    insert into #a(name,aOther)
    select  'a','pp'
    union all
    select 'b','qq'create table #b(aid numeric(5) IDENTITY(1,1) not null,name varchar(8),aOther varchar(8))
    insert into #b(name,aOther)
    select  'b','mm'
    union all
    select 'c','nn'insert into #a(name,aOther)
    select name,aother from #b
    where not name in (select name from #a)
    insert into #b(name,aOther)
    select name,aother from #a
    where not name in (select name from #b)select * from #a
    select * from #b
      

  3.   

    insert into #a(name,aOther)
    select name,aother from #b
    where not name in (select name from #a)insert into #b(name,aOther)
    select name,aother from #a
    where not name in (select name from #b)