Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2005
    Posts
    47

    Unanswered: 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,

  2. #2
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •