Subject Re: [firebird-support] Re: Running a query to find table constraints
Author Helen Borrie
At 09:06 PM 19/08/2005 +0000, you wrote:


>I thought about disabling foreign keys, but I was trying to avoid
>that. I know you can get alot of information from the system tables,
>but I have yet to figure out a query that would give me what I want.
>List of tables is easy, but trying to find the table constraints is
>getting me.

Actually, foreign key relationships are not the only kind of
dependency. For example, computed columns and check constraints could
refer to tables, views or procedures.

You can get all of the information you need by querying across the system
tables RDB$DEPENDENCIES, RDB$RELATIONS and RDB$TYPES, the latter filtered
to records where RDB$FIELD_NAME = 'RDB$OBJECT_TYPE'.

To help you to see easily what you need for your query, you could use a GUI
tool that displays the system tables. The free utility toolbox, IB_SQL
(www.ibobjects.com) does this for you in the database browser, if you check
on "SYSTEM INF". This toolbox also has a "Query Forms" tab, where you can
store a copy of your query and give it a friendly name, so that you can run
it again in future, copy it to the Export tool, and so on.

./heLen