Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
SQL
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
Posted
Updated 16-Apr-13 22:28pm
v2

1 solution

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[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900