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
 

 

Primary & secondary keys

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

New User


Joined: 13 Feb 2008
Posts: 9
Location: hyderabad

PostPosted: Wed Apr 16, 2008 7:11 pm    Post subject: Primary & secondary keys
Reply with quote

How do we knoe the primary key and seondary key of particular DB2 table from DB2 tools option.

I have selected Db2>T>ADM>DB2 system catalog > Enter the table name and Owner name and selected T > PK

But no rows were selected.


Could you please let me if there is nay other way to find out the primary and secondary key.
Back to top
View user's profile Send private message

Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Wed Apr 16, 2008 7:19 pm    Post subject:
Reply with quote

primary key and seondary key of particular DB2 table???
Back to top
View user's profile Send private message
praveen_kandrakota

New User


Joined: 13 Feb 2008
Posts: 9
Location: hyderabad

PostPosted: Wed Apr 16, 2008 7:24 pm    Post subject:
Reply with quote

Primary key and secondary keys of Db2 table
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Thu Apr 17, 2008 12:59 am    Post subject:
Reply with quote

Look at the indexes. Use X on the line where the table is displayed. You should get a screen like the following.

Code:

DB2 Admin --------------------- D2WA Indexes ----------------- Row 1 to 1 of 1
Command ===>                                                  Scroll ===> CSR 
                                                                               
Commands: DIS  STA  STO                                                       
Line commands:                                                                 
 T - Tables  D - Database  G - Storage group  P - Plans  C - Columns           
 DIS - Display index space  STA - Start index space  STO - Stop index space   
 ? - Show all line commands                                                   
                                                                               
                          Index                       Table             C C C 
Select Index Name         Owner    Table Name         Owner    U   Cols G D L T
       *                  *        *                  *        *      * * * * *
------ ------------------ -------- ------------------ -------- - ------ - - - -
       IDX1               OWNER    TABLE_NAME_T       OWNER    P      2 Y N Y 2


a P in the U column indicates it is a primary key. Check the help on this screen for what the data means.
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Thu Apr 17, 2008 1:00 am    Post subject:
Reply with quote

A table can have a primary key and a foreign key in a database. Anything else is referred to as an Index and using X on the line showing the table you want will give you the indexes for that table. Once you get the indexes you put a C in front of the index name to get the columns in that index.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Thu Apr 17, 2008 2:28 am    Post subject:
Reply with quote

Hi,

If BMC Software for DB2 is installed at your site, there are some easiser way to check for the primary key..
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 PA02 - Programmtically control attent... dodithegreat IMS DB/DC 1 Thu Apr 06, 2017 8:33 pm
No new posts Joinkeys with duplicated keys juares castro SYNCSORT 19 Fri Sep 23, 2016 5:58 am
No new posts SFTP to primary and secondary servers mallik4u JCL & VSAM 4 Tue Jun 07, 2016 12:52 pm
No new posts SUM file with secondary sorted file cdelaf32 SYNCSORT 9 Mon Apr 25, 2016 10:20 pm
No new posts Rebuilding IMS secondary index withou... Hooman24 IMS DB/DC 6 Tue Mar 29, 2016 12:22 pm


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