I am using Informix Version 7.30.Is there a system table where i can do a query and get a list of Primary Keys on the userdefined tables on all the tables that has been built in the database.
The SQL below lists all the tables with primary & foreign key relationships.
select ptabid TABID,
substr((select tabname from systables where tabid=ptabid),1,18) PRIMARY,
tabname[1,18] FOREIGN,
constrname[1,18] IDXNAME,
decode(delrule,'C','Yes','No') CASCADE
from
sysconstraints c, sysreferences r, systables s
where
c.constrtype='R' and c.constrid=r.constrid and c.tabid=s.tabid and
ptabid in
(select tabid from sysconstraints where constrtype in ('P','U'))
order by 1;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.