View previous topic :: View next topic
|
Author |
Message |
rikdeb
New User
Joined: 19 Jan 2009 Posts: 63 Location: hyderabad
|
|
|
|
Hi, Can anyone help me to find out a way to check the relationship between tables in mainframes. Suppose i have a table "x" with a column name "x_id".
I want to check if any other table have the same column or any kind of relationship exists between these 2. (assuming table qualifiers are same, ie
abc.X, abc.Y, abc.Z etc where X,Y,Z are the table names. i am using DB2) |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Code: |
SELECT SUBSTR(TBNAME,1,18) AS TABLE FROM SYSIBM.SYSCOLUMNS
WHERE NAME = 'X_ID'
ORDER BY TABLE |
|
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
If your shop has DB2 admin tools you can check for relationship among tables |
|
Back to top |
|
|
rikdeb
New User
Joined: 19 Jan 2009 Posts: 63 Location: hyderabad
|
|
|
|
thanks the above query worked.!!!...... |
|
Back to top |
|
|
satyapn9
New User
Joined: 08 Oct 2010 Posts: 27 Location: India
|
|
|
|
Hi, You can also try this query which is similar to the above:
SELECT * FROM SYSIBM.SYSCOLUMNS WHERE
NAME = 'XXXXX' AND TBCREATOR = 'DB2PROD' AND TBNAME LIKE 'YYYY%'
Here NAME is the COLUMN Name
and TBCREATOR is the HIGH Level Qualifier of the table
and TBNAME is the Table Name |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
satyapn9 wrote: |
Hi, You can also try this query which is similar to the above:
SELECT * FROM SYSIBM.SYSCOLUMNS WHERE
NAME = 'XXXXX' AND TBCREATOR = 'DB2PROD' AND TBNAME LIKE 'YYYY%'
Here NAME is the COLUMN Name
and TBCREATOR is the HIGH Level Qualifier of the table
and TBNAME is the Table Name |
satyapn9,
welcome, you are todays' recipient of dbz's 'dumb-ass post of the day' award.
1. why select all columns, in this case 47 (db2 v10) when you really only want one? the table name?
2. why have WHERE clauses that look for specific table names,
when the only thing you know is the column name?
3. why did you not bother to read the request from the TS
and provide a solution?
For wasting forum space
and
revealing that you really have little to offer,
you are hereby awarded the DUMB-ASS POST OF THE DAY award |
|
Back to top |
|
|
|