Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2005
    Posts
    30

    Unanswered: how to get primary key ?

    i would like to get primary key by system tables, is there any way?

    Find the table sysconstraints, and sysindexes, but still cant find link to syscolumns, in order to get columns which are primary key.

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    sysobjects type 'K' ?
    George
    Home | Blog

  3. #3
    Join Date
    Oct 2005
    Posts
    30
    Quote Originally Posted by georgev
    sysobjects type 'K' ?

    Error: The specified table (sysobjects) is not in the database.


    seems sysobjects doesnt exist in informix.

  4. #4
    Join Date
    Oct 2005
    Posts
    30
    after struggling, i got it :

    select colname
    from systables a, sysconstraints b, sysindexes c , syscolumns d
    where a.tabname = 'cust_ppaid_v2'
    and a.tabid = b.tabid
    and a.tabid = c.tabid
    and a.tabid = d.tabid
    and b.constrtype ='P'
    and b.idxname = c.idxname
    and (
    colno = part1 or
    colno = part2 or
    colno = part3 or
    colno = part4 or
    colno = part5 or
    colno = part6 or
    colno = part7 or
    colno = part8 or
    colno = part9 or
    colno = part10 or
    colno = part11 or
    colno = part12 or
    colno = part13 or
    colno = part14 or
    colno = part15 or
    colno = part16
    )

Posting Permissions

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