Adsense

Wednesday, August 5, 2015

Identify Foreign Keys in a DB2 database

When trying to identify what foreign keys existing in a DB2 database the sysibm.sysrels table is the best place to look.  The query below will give you all the information you need.
select *
from sysibm.sysrels
where tbname = 'CHILD TABLE'
and reftbname = 'PARENT TABLE'