Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2009
    Posts
    3

    Post Unanswered: DB2 view that spans multiple databases

    Hi,

    Could someone please advice on the correct syntax for creating a View in DB2 that will access other db2 databases in the same server.

    i have tried the following:

    CREATE VIEW testview AS
    SELECT
    table1.col2,
    table3.col6
    FROM
    Database.Schema.table AS mytable;

    this code returns an error "undefined name", any assistance in this regard would be greatly appreciated.

    Thank you in advance.

    Shai.

  2. #2
    Join Date
    Jan 2009
    Location
    Zoetermeer, Holland
    Posts
    746
    google for "federated". In the from-clause you must code nicknames instead of tablenames.
    (db2girl wrote a good piece in this forum a few weeks ago)

  3. #3
    Join Date
    Sep 2009
    Posts
    3

    Post

    Hi dr te z,

    I was hoping you could supply some sample code on how to go about this or perhaps send me a link to a thread that db2girl posted a few weeks ago.

    thank you though, i did google federated and i'm going through some of the info i got.

    thanx!

  4. #4
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    If you are using DB2 z/OS, you don't need federation because there a database is pretty much only a qualifier for tablespaces.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  5. #5
    Join Date
    Sep 2009
    Posts
    3

    db2 view spans multiple databases

    Hi Stolze,

    could you please supply sample code that will allow the achievement of this, if possible.

    thanx!

    shai.

  6. #6
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Just use a regular CREATE VIEW statement. There is nothing special about it. Of course, that's only the case for DB2 z/OS and if the table spaces reside in the same DB2 subsystem. If you have DB2 LUW, you'd need federation.
    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
  •