Insert into TAB_A(B,C)  select a,b,c from TAB_B 
假如A 为自动增长的列!

解决方案 »

  1.   

    insert into data1.dbo.tb1(字段)
    select 字段 from data2.dbo.tb2
      

  2.   

    insert into 另一数据库名..表名(AutoID) select 字段名 from 表名
      

  3.   

    是标识列?
    那就改一下:
    set identity_insert 另一数据库名..表名 on
    go
    insert 另一数据库名..表名 (AutoID)                  --字段一定要填写
    select 字段名 from 表名
    go
    set identity_insert 另一数据库名..表名 off
      

  4.   

    set identity_insert data1.dbo.tb1 on
    insert into data1.dbo.tb1(字段)
    select 字段 from data2.dbo.tb2
    set identity_insert data1.dbo.tb1 off
      

  5.   

    或者你在另一个数据库中运行:
    set identity_insert 表名 on
    go
    insert 表名 (AutoID)                  --字段一定要填写
    select 字段名 from 源数据库名..表名
    go
    set identity_insert 表名 off