Re: How to list alle tables in database
Posted in 1998
On Tue, 18 Aug 1998, Webmaster wrote:
> We have a stripped Informix database that was delivered with Netscape
> Suitespot server suite. I'm using a LiveWire interface on the database
> for some simple SQL's. I was wondering if there are any commands to
> display all tables in the database? Normally I would use something like:
>
> syscatalog.syscolumns
If you have DB-Access, there are the INFO statements. If you don't have
DB-Access, then you can only use regular SELECT statements. If you don't
already have them, you'll need to get the manuals (Informix Guide to SQL:
Reference, and Informix Guide to SQL: Syntax, possibly in two volumes).
You can get them in PDF format from:
http://www.informix.com/answers
Depending slightly on what you want in the way of 'tables' (eg what do
you want to do about synonyms, views and the system catalogue), you can
use:
SELECT tabid, tabname, owner, tabtype
FROM 'informix'.systables
WHERE tabid >= 100;
The tabtype tells you whether it is a Table, View, public Synonym or
Private synonym. The tabid condition eliminates the system catalogue.
You don't have to worry about the owner if the database is not MODE ANSI.
That doesn't tell you about the columns in the tables (that's harder) nor
does it tell you about indexes or constraints (which are both very much
harder to deal with). Look through DejaNews or something equivalent;
there's been discussion of various system catalogue queries in the last two
or three months.
Yours,
Jonathan Leffler (jleffler@informix.com) #include <witticism.h>
Guardian of DBD::Informix v0.60 -- http://www.perl.com/CPAN
Informix IDN for D4GL & Linux -- http://www.informix.com/idn