请问下现有多个结构相同的sqlserver数据库数据怎么合并?

解决方案 »

  1.   

    结构相同指的是什么,数据表,表结构,表关系???试试DTS导入导出。
      

  2.   

    insert into dbname1..tb1 select * from tbname2..tb1
    insert into dbname1..tb1 select * from tbname3..tb1
    ...
    insert into dbname1..tb1 select * from tbnamen..tb1其他表类似.
      

  3.   

    结构相同是指数据表结构,关系都相同,DTS导入导出是什么意思
      

  4.   

    如果表很多,可以通过系统表找到相关表,然后用程序循环去做.
    --表名
    select name from sysobjects
    where type='U'
      

  5.   

    这样写SQL是不是太慢了,我有几十个数据库,每个库有一百多张表
      

  6.   

    select * from A
    union all
    select * from B
      

  7.   

    insert into db1.dbo.tb
    select * from db2..tb1
    union all
    select * from db2..tb2
    union all
    select * from db2..tb3
    union all
    ......union all
    select * from db2..tbn
    union all
    select * from db3..tb1
    union all
    select * from db3..tb2
    union all
    select * from db3..tb3
    union all
    ......union all
    select * from db3..tbn
    union all
    ...
    ...
    ...
    ...
    select * from dbn..tb1
    union all
    select * from dbn..tb2
    union all
    select * from dbn..tb3
    union all
    ......union all
    select * from dbn..tbn