Subject RE: [firebird-support] Get create table SQL from system tables
Author RB Smissaert
Thanks, I found ISQL now, but I think I will just stick to building it from
the data in the system tables as it seems simpler.



[] On Behalf Of Ann W. Harrison
Sent: 18 December 2009 19:35
Subject: Re: [firebird-support] Get create table SQL from system tables

Martijn Tonies wrote:
> Hello,
>> Where in the system tables do I get (with a select SQL) the CREATE TABLE
>> statement
>> of a table that exists in the database? We are on FB 1.5.
> You don't, you either use a GUI tool like Database Workbench
> or another tool that creates such a statement by querying the
> system tables and constructing the statement.

Or use ISQL to extract all the statements necessary to recreate
the database.

Firebird stores its metadata in normalized relational tables not
.frm files. To be confusing, it uses somewhat archaic academic
terminology. You'll find tables and views in RDB$RELATIONS,
domains in RDB$FIELDS, columns in RDB$RELATION_FIELDS, the mapping
from views to tables in RDB$VIEW_RELATIONS, etc. The extract.cpp
file in ISQL has all the code to recreate definitions.

Good luck,


[Non-text portions of this message have been removed]