View previous topic :: View next topic
|
Author |
Message |
venkata.bellala
New User
Joined: 11 Mar 2005 Posts: 4
|
|
|
|
Hi,
How to find out the primary key of any table.
Regards
Venkata |
|
Back to top |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
Back to top |
|
|
Girishm
New User
Joined: 09 Mar 2005 Posts: 35 Location: Mysore
|
|
|
|
Hi,
1) get the indexes defined over the table first by using the foll query:
SELECT * FROM SYSIBM.SYSINDEXES WHERE TBNAME='TABLE_NAME'
2) by executing the following query you will come to know what are all the keys present in each indexes and the common column in all these indexes will be the primary key.
SELECT * FROM SYSIBM.SYSKEYS WHERE IXNAME='INDEX_NAME'
OR
You can also find the primary keys for any table using the PLATINUM of DB2 sub menu.
__________
GM |
|
Back to top |
|
|
|