Subject Re: [firebird-support] Tables of a database and columns of a table
Author Helen Borrie
At 03:45 PM 1/04/2011, you wrote:
>Hello everybody
>
>Is it possible for an external program know which are the tables of a
>Database?

An external program means a client program written by you? You can always query the system tables:
rdb$relations where rdb$view_source is null gives you the tables (omit the where clause to get the views as well). The column rdb$relation.name gives you the name of the table.

>And which are the columns of a table?

rdb$relation_fields gets the column names and a bit of data about each column
rdb$fields gives you the nuts and bolts for each domain definition. (The engine creates a dedicated domain for each column definition that does not specify a domain as its type.) To match up the column name from the table (relation) join the system column rdb$field_source to rdb$fields.rdb$field_name.

The free IB_SQL utility (from www.ibobjects.com) lets you check a box in its database browser to optionally display the system tables and everything about them. If you are literate in Delphi, you can also get the sources for this toolset in the trial download, in case you want to search for the SQL for those queries it does to display that info. Even if you're not, there's more than enough stuff in the browser tabs for you to see how it extracts the info.

./heLen