Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2007
    Posts
    4

    Unanswered: can i join all the 200 tables? (was "DB2")

    In one tableset i have 200 tables .can i join all the 200 tables or can join all the tables inside the tableset

    how can i find the unique variable to join

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    Can you give an example of what you are trying to achieve?
    Are you asking suggestions for denormalizing data or are you asking about SQL ?


    Also, give more details about DB2 you are using - version, fixpak, operating system etc.
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    Quote Originally Posted by charles18
    In one tableset i have 200 tables.
    can i join all the 200 tables or can I join all the tables inside the tableset?

    how can i find the unique variable to join?
    If you are referring to NATURAL JOIN: no, DB2 does not support "automatic" selection of join columns. The concept of natural join is generally considered "dangerous" and "better not used".
    Back to DB2: you will have to spell out all 200 table names, and also all (at least) 199 join conditions.

    Apart from that, joins of up to 225 tables are possible (at least, with DB2 on z/OS from version 8 on).
    --_Peter Vanroose,
    __IBM Certified Database Administrator, DB2 9 for z/OS
    __IBM Certified Application Developer
    __ABIS Training and Consulting
    __http://www.abis.be/

  4. #4
    Join Date
    Nov 2007
    Posts
    4

    db2

    let me brief out requirement . I am developing one tool in rexx . for that i am displaying all the tables from the tablespace to the user so that user selects few tables .so i need to join the selected tables (i.e join query have to executed ).i need to know the variable which will be used to join .In db2 .all the tables inside a tablespace will have relations between them right .how to retreive that

  5. #5
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    You can retrieve relationship between tables using SYSIBM.SQLFOREIGNKEYS procedure or by using the catalog tables (owner SYSIBM)

    But, your assumption that the tables will have a relationship between them is not correct. There may be tables that do not have any relationship between them. Even, if a relationship actually exists (ie, business rule), they may not be defined in the database.



    Quote Originally Posted by charles18
    let me brief out requirement . I am developing one tool in rexx . for that i am displaying all the tables from the tablespace to the user so that user selects few tables .so i need to join the selected tables (i.e join query have to executed ).i need to know the variable which will be used to join .In db2 .all the tables inside a tablespace will have relations between them right .how to retreive that
    Visit the new-look IDUG Website , register to gain access to the excellent content.

Posting Permissions

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