Re: Problem with primary key
Posted in 1998
Hi Vinhson,
first: you'll find out where it's a primary key or not when you add
"AND constrtype = 'P'".
Now to answer your question: you'll find the column idxname in
the table sysconstraints. Find the index in sysindexes and note all
the partnum-columns which are <> 0; these are the colno's from
the syscolumns-table. Because of the "denormalized" structure
of the sysindexes-table there is no way to get the information in
a single SQL (if you don't want to join the syscolumns-table
16-times). In dbaccess you could of course use the INFO
menu or "info indexes for table".
Hope that helps,
Peter
___________________
Mag. Peter Kolmhofer
DBA
Porsche Informatik (Austria)
Vinhson wrote:
> Hello all,
>
> I'm using Informix Server 7.2x. The Informix system table
> sysconstraints allows me to find out if a given table, say
> known_table, has a primary key via, for instance,
> select * from informix.sysconstraints
> where tabid = tabid_of_known_table>
> Suppose that the above select query indicated that known_table
> has a primary key. Does anyone know how I can find the column name
> associated with that key?
>
> Any help or suggestion is very much appreciated.
>
> Vinhson
> Email: nguyenv@cognos.com