Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to find out the Parent Table of a Table in DB2

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
prodigy

New User


Joined: 15 May 2006
Posts: 28

PostPosted: Tue Oct 10, 2006 5:17 pm    Post subject: How to find out the Parent Table of a Table in DB2
Reply with quote

Can anyone tell me how to find out a Parent Table of a table in DB2 without using any tools. May be thru some query or something else.
Please can anyone help me out. Will be very useful.

Thx
Back to top
View user's profile Send private message

MFRASHEED

Active User


Joined: 14 Jun 2005
Posts: 186
Location: USA

PostPosted: Tue Oct 10, 2006 8:16 pm    Post subject: Re: How to find out the Parent Table of a Table in DB2
Reply with quote

Try this SQL:

Code:

SELECT *                     
FROM SYSIBM.SYSRELS         
                             
WHERE TBNAME = 'Table Name'   



In returned data column REFTBNAME is the parent table.
Back to top
View user's profile Send private message
prodigy

New User


Joined: 15 May 2006
Posts: 28

PostPosted: Wed Oct 11, 2006 11:28 am    Post subject: Re: How to find out the Parent Table of a Table in DB2
Reply with quote

Thx mate... My id doesnt have enough previlege to even read from Catalog...wondering wat to do!!!!!!! icon_sad.gif
Back to top
View user's profile Send private message
surya_pathaus

Active User


Joined: 28 Aug 2006
Posts: 110

PostPosted: Wed Oct 11, 2006 5:29 pm    Post subject: Re: How to find out the Parent Table of a Table in DB2
Reply with quote

Hi,

You can also check parent table via DDL of the child table.

Check the DDL foreign key. There parent table will be defined.
Back to top
View user's profile Send private message
prodigy

New User


Joined: 15 May 2006
Posts: 28

PostPosted: Thu Oct 12, 2006 12:32 pm    Post subject:
Reply with quote

Where can i see the DDL for a child table.??? icon_sad.gif
Back to top
View user's profile Send private message
surya_pathaus

Active User


Joined: 28 Aug 2006
Posts: 110

PostPosted: Thu Oct 12, 2006 3:43 pm    Post subject:
Reply with quote

Hi,

In File Aid, go to 3.4 "Object List Processing" .
Give details of table then give the command GD at "CMD" column.

In Platinum, select the table and give DDL at the "CMD" column.
Back to top
View user's profile Send private message
prashanth1

New User


Joined: 27 Sep 2006
Posts: 47
Location: Hyderabad

PostPosted: Thu Oct 12, 2006 4:54 pm    Post subject:
Reply with quote

Try with the following Query


SELECT * FROM SYSIBM.SYSRELS;

It will display all the fields alongwith CREATOR, TBNAME, RELNAME, REFTBNAME, REFTBCREATOR, COLCOUNT

1) CREATOR : Name of the Owner of Child table

2) TBNAME : Child Table Name

3) RELNAME : Here it displays the column name ( defined as Foreign key in Child table and Primary key in Parent table)

4) REFTBNAME : Parent table name

5) REFTBCREATOR : Owner for the parent table


Pls Correct Me, If I wrong
Back to top
View user's profile Send private message
prodigy

New User


Joined: 15 May 2006
Posts: 28

PostPosted: Mon Oct 16, 2006 4:37 pm    Post subject:
Reply with quote

Thx Guys.... Thx a lot for ur replies
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts Table(Unicode(Graphic) table) loading... muralikrishnan_new DB2 0 Thu Oct 05, 2017 5:10 pm
No new posts Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts PC (UTF-8) -> z/OS (EBCDIC) -> ... prino All Other Mainframe Topics 4 Fri Sep 01, 2017 1:47 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us