db2 "select constname,tabname,colname from syscat.keycoluse where tabname='TABLENAME' "
It will give you.....
Example:::
db2inst1@confonet:~> db2 "select constname,tabname,colname from syscat.keycoluse where tabname='COMPLAINANT_RESPONDENT'"
--------------Output--------------------------------
CONSTNAME TABNAME COLNAME
-------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------
SQL100416165400090 COMPLAINANT_RESPONDENT CRSEQ
SQL100416165400090 COMPLAINANT_RESPONDENT CR_TYPE
SQL100416165400090 COMPLAINANT_RESPONDENT FANO
3 record(s) selected.
==========================================================
-------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------
SQL100416165400090 COMPLAINANT_RESPONDENT CRSEQ
SQL100416165400090 COMPLAINANT_RESPONDENT CR_TYPE
SQL100416165400090 COMPLAINANT_RESPONDENT FANO
3 record(s) selected.
==========================================================
Here COMPLAINANT_RESPONDENT table have a composite primary key on three column (FANO,CRSEQ,CR_TYPE)
No comments:
Post a Comment