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 > looking for an object_id in all tables

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-21-04, 05:40
csorvy csorvy is offline
Registered User
 
Join Date: Jan 2004
Location: Germany
Posts: 2
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
Reply With Quote
  #2 (permalink)  
Old 02-02-04, 17:37
amajid amajid is offline
Registered User
 
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

Quote:
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
Reply With Quote
  #3 (permalink)  
Old 02-06-04, 09:57
csorvy csorvy is offline
Registered User
 
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.



Quote:
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
Reply With Quote
  #4 (permalink)  
Old 02-06-04, 10:26
Walter Janissen Walter Janissen is offline
Registered User
 
Join Date: Nov 2003
Location: Germany
Posts: 62
No chance
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