Post by c***@hotmail.comKnut,
Can I do something like this...?
SELECT * FROM SYSCAT.COLUMNS where KeySeq = 1;
Is it same with your SELECT * FROM syscat.tabconst WHERE type = 'P'?
No, it is not. The KEYSEQ column tells you the position of the column in
the PK of the table. If there is more than one column in the PK, you would
have to check for KEYSEQ IS NOT NULL. Besides, querying SYSCAT.TABCONST
returns the constraint while querying SYSCAT.COLUMNS returns information
about the column in the constraint - that's a different level of
information.
If you want to know the columns of a unique constraint (PKs are the same as
UNIQUE constraints), you can use the catalog view SYSCAT.KEYCOLUSE.
--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany