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

how we can find primary key?


IBM Mainframe Forums -> FAQ & Basics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kundams

New User


Joined: 23 Jul 2007
Posts: 1
Location: Gurgaon

PostPosted: Mon Sep 17, 2007 7:30 pm
Reply with quote

How we can find out primary key of a table and length of each field.

--------
K. Suman
Back to top
View user's profile Send private message
twissi

Active User


Joined: 01 Aug 2005
Posts: 105
Location: Somerset, NJ

PostPosted: Mon Sep 17, 2007 8:04 pm
Reply with quote

Suman,

To find the primary key of a table in a particular database:

Code:
SELECT NAME FROM SYSIBM.SYSINDEXES WHERE TBNAME='your_table_name'
AND TBCREATOR ='your_database_name' AND UNIQUERULE='P'   


To find the length of each field:

Code:
SELECT NAME,COLTYPE,LENGTH FROM SYSIBM.SYSCOLUMNS WHERE TBNAME='your_table_name' AND TB
CREATOR='your_database_name' ORDER BY COLNO                                               


Cheers, Twissi.
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 -> FAQ & Basics

 


Similar Topics
Topic Forum Replies
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
No new posts Find the size of a PS file before rea... COBOL Programming 13
No new posts Cobol prog to put an indicator on the... JCL & VSAM 1
Search our Forums:

Back to Top