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
 

 

how we can find primary key?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> FAQ & Off Topics
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    Post subject: how we can find primary key?
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> FAQ & Off Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts find particular member name in PDS us... ravi243 CLIST & REXX 10 Mon Dec 19, 2016 6:44 pm
No new posts How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm
No new posts Find out a active PGM jpsager JCL & VSAM 10 Fri Oct 07, 2016 4:32 pm
No new posts How to find a CICS resource used in C... Arunkumar Chandrasekaran CICS 8 Thu Sep 29, 2016 1:45 pm
No new posts how to find clist's or view library Andrew Hsia CLIST & REXX 4 Tue Jun 28, 2016 6:07 pm


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