新表字段和旧表一样
我用如下语句报错
insert into abc
select * from stu
except
select * from abc
  告诉我“消息 8101,级别 16,状态 1,第 1 行
仅当使用了列列表并且 IDENTITY_INSERT 为 ON 时,才能为表'abc'中的标识列指定显式值。”如何解决呢

解决方案 »

  1.   

    insert into abc
     select col2,col3 from stu
     except
     select col2,col3 from abc
    显式指定列名,你的表有自增列,是无法导过去的。
      

  2.   

    insert abc(col2,col3)
    select col2,col3 from stu
    except
    select col2,col3 from abc
      

  3.   

    insert into abc(除自增外的列全部写上)
    select 除自增外的列全部写上 from stu
    except
    select 除自增外的列全部写上 from abc