Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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 Command to find TMEMBER name for a TPIPE Siva NKK Kothamasu IMS DB/DC 0 Wed Aug 16, 2017 6:08 pm
No new posts Adding a userid to SMTP Security table Yolanda Harvey JCL & VSAM 1 Sun Aug 13, 2017 6:16 pm
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm
No new posts find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts To find out size allocated to a seque... ashek15 JCL & VSAM 15 Thu Apr 27, 2017 9:42 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us