Results 1 to 1 of 1
  1. #1
    Join Date
    Jun 2009
    Location
    India
    Posts
    3

    Unanswered: 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 08:23.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •