?? Getting info on foreign keys from sys*
Posted in 1998
John Mullee — — source: Informix-list mailing list archive (1991-1998)
How can I retieve, using something like the following query,
a list of tables which reference a table 'X' via foreign keys?
select T.tabname, C.constrtype, C.constrname,
R.constrid, I.idxname
from sysconstraints C, sysreferences R,
sysindices I, systables T
where T.tabid = I.tabid
and T.tabid = C.tabid
and R.constrid = C.constrid
and I.idxname = C.idxname
and T.tabname='X'
order by 1, 2, 3, 4, 5;
this returns:
popul R r331_1750 1750 331_1750
popul R r331_1751 1751 331_1751
popul R r331_1752 1752 331_1752
popul R r331_1753 1753 331_1753
popul R r331_1754 1754 331_1754
.. but tells me nothing about the fields which are referred from,
or the tables to which they refer....
Help please??
John