IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to identify the primary key in a table?


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
chandu_605k

New User


Joined: 17 Apr 2006
Posts: 7
Location: Kansas City

PostPosted: Tue Jul 25, 2006 12:03 pm
Reply with quote

Hi Friendz,
This is reagrding DB2. I know the table name is X. But i don't know what is the primary key defined in this table : X. Could you please let me know, if you know how to find this?


Thanks & Regards
CSR
Back to top
View user's profile Send private message
anamikak

New User


Joined: 10 May 2006
Posts: 64
Location: Singapore

PostPosted: Tue Jul 25, 2006 12:40 pm
Reply with quote

You can query the catalog tables for this-

Try out this query:

SELECT NAME,UNIQUERULE from SYSIBM.SYSINDEXSES
where TBNAME= 'your table name' and UNIQUERULE = 'P';
Back to top
View user's profile Send private message
neelesht

New User


Joined: 24 Jul 2006
Posts: 99
Location: Los Angeles

PostPosted: Fri Jul 28, 2006 12:37 pm
Reply with quote

Hi Anamika,

what does UNIQUERULE = 'P' mean here ?

Thanks.
Back to top
View user's profile Send private message
chandu_605k

New User


Joined: 17 Apr 2006
Posts: 7
Location: Kansas City

PostPosted: Fri Jul 28, 2006 12:44 pm
Reply with quote

Hi Anamika,
Thanks for sending a quick reply. Its working. Thanks Once again.


Hi Neel(Simply),
'P' means Primary key.
Please correct me if i am wrong.

Thanks & Regards
CSR
Back to top
View user's profile Send private message
neelesht

New User


Joined: 24 Jul 2006
Posts: 99
Location: Los Angeles

PostPosted: Fri Jul 28, 2006 12:46 pm
Reply with quote

Thanks CSR.......so sorry for such a silly qns......

Thanks Anamika.

Thanks.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
No new posts Dynamically pass table name to a sele... DB2 2
Search our Forums:

Back to Top