将数据从一个数据库表移动到另一个数据库表 [英] Moving Datas from One database Table to another database table

查看:165
本文介绍了将数据从一个数据库表移动到另一个数据库表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi Frnds,

我需要将数据从一个数据库表传输到另一个数据库表。如何为此编写查询。

解决方案

< blockquote>看看这里:

将数据库从一台服务器移动到SQL Server 2008中的另一台服务器 [ ^ ]

SQL SERVER - 将数据从一个表插入另一个表 - INSERT INTO SELECT - SELECT INTO TABLE [< a href =http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into -table /target =_ blanktitle =New Window> ^ ]

将数据从一个表传输到另一个表 [ ^ ]

请参阅这些链接



SqlBulkCopy类 [ ^ ]



使用C#.Net进行SQL批量复制 [ ^ ]



使用SqlBulkCopy传输数据 [ ^ ]



这个概念可以帮助你大量数据。



[更新]:示例

 < span class =code-keyword> insert   into  table1 
select * 来自 table2
其中 table2.xyzid 选择 xyzid 来自 table1)



这里可以找到更多选项



SQL Server将所有行从一个表复制到另一个表,即复制表 [ ^ ]



问候......:笑:


试试这个:



  INSERT   INTO  DATABASE2.DBO.TABLEX(FIELD1,FIELD2,...)
< span class =code-keyword> SELECT FIELD1,FIELD2,... FROM DATABASE1.DBO.TABLEX

< span class =code-comment> - 非字段列表必须与表格相同


Hi Frnds,
I need to transfer datas from one database table to another database table.How to write query for that.

解决方案

Have a look here:
Move a database from one server to another server in SQL Server 2008[^]
SQL SERVER – Insert Data From One Table to Another Table – INSERT INTO SELECT – SELECT INTO TABLE[^]
Transferring Data from One Table to Another[^]


Refer to these links

SqlBulkCopy Class[^]

SQL Bulk Copy with C#.Net[^]

Transferring Data Using SqlBulkCopy[^]

This concept will help you even with the large amount of data.

[Update]:Example

insert into table1
select * from table2
where table2.xyzid not in(select xyzid from table1)


And more options can be found here

SQL Server copy all rows from one table into another i.e duplicate table[^]

Regards..:laugh:


Try this :

INSERT INTO DATABASE2.DBO.TABLEX(FIELD1, FIELD2, ...)
SELECT FIELD1, FIELD2, ... FROM DATABASE1.DBO.TABLEX

-- NOT FIELD LIST MUST BE SAME FOR BOTH TABLES


这篇关于将数据从一个数据库表移动到另一个数据库表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆