07-02-07, 10:48 #1Registered User
- Join Date
- Jul 2005
Unanswered: Selecting data from different databases on same server
Can you please help me build a query which helps me select data from tables existing in different databases .
1) On the same server and same instance.
2) On the same server and different Instances.
3) On different servers.
I tried this query which returns an error.
SELECT T1.*,T2.* FROM TEST.EMPLOYEE T1 JOIN PAYMENT.dbo.TEST.EMPLOYEE T2 ON T1.EMPNUM = T2.EMPNUM
SQL0108N The name "EMPLOYEE" has the wrong number of qualifiers.
SQL0108N The name "EMPLOYEE " has the wrong number of qualifiers.
The name "<name>" is improperly qualified.
The object given the name "<name>" can only have one
A column name is qualified with a table name, which is either
qualified or unqualified, or a correlation name. In some
contexts, a column name requires a table name qualifier.
The statement cannot be processed.
Ensure that the name for the object is qualified correctly.
sqlcode : -108
sqlstate : 42601
What is the information I need to add for dbo in PAYMENT.dbo.TEST.EMPLOYEE ?
Thanks in Advance,
07-02-07, 14:46 #2Registered User
- Join Date
- Jan 2007
- Jena, Germany
Have a look at DB2's federation capablities and nicknames. (This has been discussed extensively before, so you should quickly find something.)Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development