If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Selecting data from different databases on same server

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-02-07, 10:48
venky5436 venky5436 is offline
Registered User
 
Join Date: Jul 2005
Posts: 47
Selecting data from different databases on same server

Hi All,

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.
SQLSTATE=42601

SQL0108N The name "EMPLOYEE " has the wrong number of qualifiers.

Explanation:

The name "<name>" is improperly qualified.

The object given the name "<name>" can only have one
qualifier.

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.

User Response:

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,
Venkat,
Reply With Quote
  #2 (permalink)  
Old 07-02-07, 14:46
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On