View previous topic :: View next topic
|
Author |
Message |
vishal_arora
New User
Joined: 20 May 2005 Posts: 16
|
|
|
|
Hi ,
My requirement is as follows :
We have a masterid and want to get a list of which all tables host this master id or in other words all the table dependenceis of this master id .
Is there any catalog query which can be executed against the master id which will fetch us the list of all the tables which hold this master id .
All replies appreciated !! |
|
Back to top |
|
|
Manuneedhi K
Active User
Joined: 07 May 2008 Posts: 115 Location: Chennai
|
|
|
|
Table SYSIBM.SYSCOLUMNS can be searched to get all the tables which hold this column. |
|
Back to top |
|
|
vishal_arora
New User
Joined: 20 May 2005 Posts: 16
|
|
|
|
Thanks Manu ....
But i think i did'nt explained it right to the forum .... my mistake ..
Requirement is :
Suppose the Master_id column contains value such as : 'FT1099987'
and i want all the tables where master_id='FT1099987' resides.
I.e The list of tables which holds this 'FT1099987' .
SYSIBM.SYSCOLUMN provided me the tables list which holds the column MASTER_ID whereas my query is for a value contained inthis field.
Hope i am clear this time .... Pls post the query if anyone knows.. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Pls post the query if anyone knows.. |
I believe there is no single query that will do this.
If this was my requirement, i'd write a query that identifies all of the tables with the "master_id" column. Then, i'd use that list of tables to generate a "select count(*) from xxx where master_id = 'FT1099987' " query for each table in the list and execute that collection of queries. All of the non-zero counts would be a table containing the value you are looking for. Hopefully, master_id is a key. . . |
|
Back to top |
|
|
tarun_bhardwaj
New User
Joined: 18 Jul 2003 Posts: 39 Location: delhi
|
|
|
|
You can do it by writing a REXX. I have written a REXX tool for this earlier but am not sure how apt it would be with your environment. |
|
Back to top |
|
|
|