mayankshah:
I've never had any luck in accessing two databases such that I could transfer any data between them without getting the data locally and then retransmitting it. However, some databases (e.g. MS SQL Server) have the ability to link to a different server such that you can transfer data between the databases using a simple select. You might investigate that possibility.
In fact, I'm working on a project right now that connects to over 20 different databases to generate some summary reports via statements like:
INSERT Summary ( <fieldlist> )
SELECT <expressions>
FROM <Server>.<Database>.<schema>.<table> ALIAS1
JOIN <Server2>.<Database2>.<schema2>.<table2> ALIAS2
ON ALIAS1.CommonKey = ALIAS2.CommonKey
WHERE <expression>
If you can swing it, this is the way you'd want to go as it will save network traffic (the data goes straight from one server to the other without having to visit the computer running your program), simplify your coding (half as many SQL statements to run, other databases are easier to access by just adding an additional qualifier to their name).
If you're in a large shop, this can help you document data flows between systems, as the linked server definitions can be accessed by the DBAs.
...roboticus |