If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > How to get PK & FK constraints and Indexes from Catalog Tables

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-16-09, 07:04
manishsv manishsv is offline
Registered User
 
Join Date: Jun 2009
Location: India
Posts: 3
How to get PK & FK constraints and Indexes from Catalog Tables

HI All,

I need to create SQL queries to get Constraints and Indexes from DB2 system catalog tables.

Can any one help me out to get sql queries for listed below containts.

1. IDENTIFYING PRIMARY KEY CONSTRAINTS
2. IDENTIFYING PRIMARY KEY INDEXES
3. IDENTIFYING FOREIGN KEY CONSTRAINTS
4. IDENTIFYING FOREIGN KEY INDEXES


For example I have created one query to get Primary Key Constraints , like this I need quries for mentioned above containts.

SELECT SUBSTR(A.TBNAME,1,20) AS "TABLE NAME",
SUBSTR(A.COLNAME,1,20) AS "COLUMN NAME",
SUBSTR(A.RELNAME,1,20) AS "RELATION NAME"
FROM SYSIBM.SYSFOREIGNKEYS A, SYSIBM.SYSRELS B
WHERE A.TBNAME= B.REFTBNAME;

Satyaram : Initially I forgot to give my installation info that's why I have given this info aftr reading ur post.
I am working on DB2 V8 on mainframe, using Spufi and QMF

Thanks & Regards,
Manish

Last edited by manishsv; 06-16-09 at 07:23.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On