将数据从一个数据库传输到另一个数据库 [英] transfer data from one database to another data base

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

问题描述

海...我有三个表与不同的数据库我需要移动数据TableName2基于分支到tablename3,每个ItmsGrpCod(TableName3)转移(FrmDate ToDate百分比)请任何人给我的想法...

TableName1(parenttable)Databasename1

 DocEntry Branch FrmDate ToDate 
1 01 2013-04-12 2013-04-16
2 01 2013-04-12 2013-04-16
3 01 2013-04-12 2013-04-16
4 01 2013-04-12 2013-04-16
5 03 2013 -04-12 2013-04-16
6 02 2013-04-12 2013-04-16



TableName2 Databasename1

 DocEntry FrmDate ToDate百分比
1 12/04/2013 16/04/2013 10
2 12/04/2013 16/04/2013 9
3 12 / 04/2013 16/04/2013 10
4 12/04/2013 16/04/2013 12
5 12/04/2013 16/04/2013 10

< br $>


TableName3 Databasename3

 ItmsGrpCod,ItmsGrpNam 
100 项目
101 附件
102 HP打印机
103 IBM打印机
104 个电脑
105 服务器





i基于分支ID需要输出这样的(TableName1 Databasename1)

 DocEntry GrpCode FrmSlab ToSlab百分比
1 100 12/04/2013 12/04/2013 10
2 101 12/04/2013 12/04/2013 9
3 102 12/04/2013 12/04/2013 10
4 103 12/04/2013 12/04 / 2013 12
5 104 12/04/2013 12/04/2013 10
105 12/04/2013 12/04/2013 12

解决方案

您可以使用SP_AddLinkedServer互相连接服务器,然后您可以编写简单查询,将数据从一个表插入另一个表。

请参考以下链接



http://msdn.microsoft.com/en- in / library / ms190479.aspx [ ^ ]



http://www.sql-server-performance.com/forum/threads/how-to-use -sp_addlinkedserver.17119 / [ ^ ]



http://www.sqlservercentral.com/Forums/Topic98741-9-1.aspx [ ^ ]


Hai.. i have three table with different database i need move data TableName2 based on Branch to tablename3 , each ItmsGrpCod(TableName3 )to transfer the(FrmDate ToDate Percent)Please any one give me idea...
TableName1(parenttable )Databasename1

DocEntry	Branch	FrmDate	ToDate
1	01	2013-04-12	2013-04-16
2	01	2013-04-12	2013-04-16
3	01	2013-04-12	2013-04-16
4	01	2013-04-12	2013-04-16
5	03	2013-04-12	2013-04-16
6	02	2013-04-12	2013-04-16


TableName2 Databasename1

DocEntry 	FrmDate	         ToDate 	Percent
1		12/04/2013	16/04/2013	10
2		12/04/2013	16/04/2013	9
3		12/04/2013	16/04/2013	10
4		12/04/2013	16/04/2013	12
5		12/04/2013	16/04/2013	10



TableName3 Databasename3

ItmsGrpCod,ItmsGrpNam
100	Items
101	Accessories
102	HP Printers
103	IBM Printers
104	PCs
105	Servers



i need out put like this based on Branch id(TableName1 Databasename1)

DocEntry GrpCode FrmSlab	ToSlab	Percent
1	100	12/04/2013	12/04/2013	10
2	101	12/04/2013	12/04/2013	9
3	102	12/04/2013	12/04/2013	10
4	103	12/04/2013	12/04/2013	12
5	104	12/04/2013	12/04/2013	10
	105	12/04/2013	12/04/2013	12

解决方案

You can Use SP_AddLinkedServer for connecting server each other and then you can write simple query for inserting data from one table to another.
Please refer below link

http://msdn.microsoft.com/en-in/library/ms190479.aspx[^]

http://www.sql-server-performance.com/forum/threads/how-to-use-sp_addlinkedserver.17119/[^]

http://www.sqlservercentral.com/Forums/Topic98741-9-1.aspx[^]


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

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