How to search informix database for a column

zach picture zach · Jul 30, 2012 · Viewed 10k times · Source

I want to be able to search an Informix DB for a column. In the main table there is a cust_nbr column, that is then referenced in a unknown number of tables.

In Informix, is there a way to query the DB and get all the tables that use the cust_nbr?

Answer

zach picture zach · Jul 30, 2012
SELECT tabname, colno, colname  
FROM systables a, syscolumns b 
WHERE a.tabid = b.tabid 
and colname = "cust_nbr"
ORDER BY colno; 

I found this code in the same place and added the extra restriant with colname = cust_nbr.

This seems to have worked for me. i will verify it, but all signs look like it worked.

i found that in the Using the Informix Catalogs mentioned in the other post