select FK.CREATOR, FK.TBNAME, FK.COLNAME, FK.COLSEQ, PK.TBCREATOR,
PK.TBNAME, PK.NAME, R.RELNAME
from SYSIBM.SYSRELS R,
SYSIBM.SYSFOREIGNKEYS FK,
SYSIBM.SYSCOLUMNS PK
where R.CREATOR= ?
and R.TBNAME= ?
and R.RELNAME = FK.RELNAME
and R.CREATOR=FK.CREATOR
and R.TBNAME=FK.TBNAME
and R.REFTBCREATOR=PK.TBCREATOR
and R.REFTBNAME=PK.TBNAME
and FK.COLSEQ=PK.KEYSEQ
ORDER BY R.RELNAME, FK.COLSEQ asc
Yury Jhol
Chief Systems Architect
www.ispirer.com
<fo********@gmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Hi,
Please find me with this, I don't which IBM sys table to query.
I am using DB2 7.1 in OS390. I need to retrieve the FK reference
information, i.e., which PK column a FK is refer to? I tried SYSRELS
table, but it only gives me the reference/parent table information.
Thanks lot!