View previous topic :: View next topic
|
Author |
Message |
praveen_kandrakota
New User
Joined: 13 Feb 2008 Posts: 9 Location: hyderabad
|
|
|
|
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 |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
primary key and seondary key of particular DB2 table??? |
|
Back to top |
|
|
praveen_kandrakota
New User
Joined: 13 Feb 2008 Posts: 9 Location: hyderabad
|
|
|
|
Primary key and secondary keys of Db2 table |
|
Back to top |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
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 |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
|