表A中有6千万数据,怎么吧表A中的数据快速导到表B中,表A,B结构一样,B表多1个字段。
有没什么方法?表A如:
create table A as 
(
ID int not null,
a  int null,
b  int null,
c  int null,
d  varchar(10) null
)
表B如下
create table B as 
(
ID int not null,
a  int null,
b  int null,
c  int null,
d  varchar(10) null,
e  varchar(10) null
)

解决方案 »

  1.   

    try this,truncate table 表Binsert into 表B(ID,a,b,c,d) with (TABLOCK) 
     select ID,a,b,c,d from 表A (nolock)
      

  2.   

    1楼正解,如果还嫌慢就用BCP,先导到一个结构一样的新表,再给新表加一列,再改名就行了
      

  3.   


    create table A
    (
    ID int not null,
    a  int null,
    b  int null,
    c  int null,
    d  varchar(10) null
    )create table B
    (
    ID int not null,
    a  int null,
    b  int null,
    c  int null,
    d  varchar(10) null,
    e  varchar(10) null
    )
    godrop table B
    go--这样复制是最快的
    select * into B
    from A--给B表新增1列
    alter table B
    add e varchar(10) null
      

  4.   


    6千万的数据导入后,在修改表结构,是很慢的吧。个人感觉bcp比较快。