Thursday, 12 June 2014

How to find out foreign key on DB2 tables

How to find out foreign key on DB2 tables

syscat.references - db2look

SYSCAT.REFERENCES

select substr(tabname,1,20) table_name,substr(constname,1,20) 
fk_name,substr(REFTABNAME,1,12) parent_table,substr(refkeyname,1,20) 
pk_orig_table,fk_colnames from syscat.references where tabname = 
'TABLE_NAME'


  DB2LOOK

db2look -d <database_name> -e -t  <table_name>
Look for 'DDL Statements for foreign keys on Table table_name in the output.

No comments:

Post a Comment