Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Location
    Germany
    Posts
    2

    Unanswered: looking for an object_id in all tables

    Hi,

    I use a DB2-database with over 180 tables (these tables describe the object model of data management system) and I try to find out how these tables work together. For this cause I would like to search for a special value (for example for an object_id which is unique and appaires in many tables in columns with different names) without knowing in what table or what column to search. I would like to find out in which tables and in which columns this value appaires.

    Is there an SQL-Statement or a tool which can do this?

    Thanks a lot for any help

  2. #2
    Join Date
    Jan 2004
    Location
    USA
    Posts
    4

    Re: looking for an object_id in all tables

    If I understand it right, you are looking for a way to find out all occurances of a given column name in different tables. The following query could do it:

    SELECT NAME, TBNAME
    FROM SYSIBM.SYSCOLUMNS
    WHERE LOWER(NAME) = LOWER('object_id')
    ORDER BY TBNAME

    Hope this helps.

    Best Regards,
    Abdul

    Originally posted by csorvy
    Hi,

    I use a DB2-database with over 180 tables (these tables describe the object model of data management system) and I try to find out how these tables work together. For this cause I would like to search for a special value (for example for an object_id which is unique and appaires in many tables in columns with different names) without knowing in what table or what column to search. I would like to find out in which tables and in which columns this value appaires.

    Is there an SQL-Statement or a tool which can do this?

    Thanks a lot for any help

  3. #3
    Join Date
    Jan 2004
    Location
    Germany
    Posts
    2

    Re: looking for an object_id in all tables

    That helps, but I am looking for something else. I am looking for a special value in all columns in all tables. I do not know what the names of the tables is, neither do I know the names of the columns. I have only a special value, like the surename of a user e.g.: Alexander or an ID like 03473845599388.

    So there may be three tables with some columns and I would like to find out which columns in which tables contains the value "Alexander" or the ID 03473845599388.

    the result should be something like this:

    Table Column
    _________________
    my_friends surename
    birthdays name

    Both tables my_friends and birthdays may contain the value "Alexander" but the first one contains it in the column surename the second one in name.



    Originally posted by amajid
    If I understand it right, you are looking for a way to find out all occurances of a given column name in different tables. The following query could do it:

    SELECT NAME, TBNAME
    FROM SYSIBM.SYSCOLUMNS
    WHERE LOWER(NAME) = LOWER('object_id')
    ORDER BY TBNAME

    Hope this helps.

    Best Regards,
    Abdul

  4. #4
    Join Date
    Nov 2003
    Location
    Germany
    Posts
    62
    No chance

Posting Permissions

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