Linker IT Software
Google
Web www.oraxcel.com
menubar-top-links menubar-top-rechts
Home Help Search Login
Welcome, Guest. Please Login.
SQL*XL: Database to Excel bridge litLIB: Excel power functions pack ExcelLock: Locking and securing your valuable Excel spreadsheets encOffice: Protect your Excel file easy and safe encOffice: Protect your Excel file easy and safe
Pages: 1
Running queries against two databases (Read 3803 times)
Gerrit-Jan Linker
YaBB Administrator
*****




Posts: 75
Running queries against two databases
21.12.05 at 10:10:55
 
Ike from the Phillipines asked the following question:
 
Question:
Can I query two separate databases?
 
Answer:
Yes you can however you must be a bit careful using the refresh query option. When using the refresh query option SQL*XL assumes you will run the statements against the current database connection.
 
You can run one statement against database1 and then connect to database2 to run the second statement. If you record the whole session in a macro you have a command to run two commands against different databases.
 
You can make use of the usual database tricks to access other databases. With Oracle e.g. you can use the @ symbol to denote a particular database if you have setup the database links in Oracle:
select * from emp@my1stDatabase;
selelct * from emp@my2ndDatabase;
 
When you use SQL Server you can use the openquery function to run a query against a different database. Again here you need to setup the database link first.
Back to top
 
 

Gerrit-Jan Linker
Linker IT Software
Email WWW Gerrit-Jan Linker   IP Logged
Gerrit-Jan Linker
YaBB Administrator
*****




Posts: 75
Re: Running queries against two databases
Reply #1 - 18.01.06 at 11:29:20
 
I have done a test with the openquery technique today. It contains a full example that you can recreate  yourself easily.
 
Please see:
http://www.oraxcel.com/cgi-bin/yabb2/YaBB.pl?num=1136833979/0#3
Back to top
 
 

Gerrit-Jan Linker
Linker IT Software
Email WWW Gerrit-Jan Linker   IP Logged
Pages: 1