Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Foreign key constraints

Status
Not open for further replies.

cyberant

Programmer
Sep 21, 2003
44
ZA
Hi all!

I'm desiging a database rebuild utiltiy. I'm needing for each table to be rebuilt accoring to their referential integrity settings i.e. If table 1 has a foreign key constraint on table 2, then table 2 must be rebuilt first.

Any ideas?
 
My idea is that you are part right.

An alternative approach would be to create all tables first and apply the FKs in a later stage.

Either way: what is your question?

Martijn Tonies
Database Workbench - the developer tool for InterBase, Firebird, MySQL & MS SQL Server
 
I'm working on a one click solution, what I need to find out is what are the referential constraints on each table. I know I can do this by simply opening the table up and viewing them, but I'm looking for something more programatic and automatic. It would be ideal if I could create a temporary list of tables in order of their referential constraints to rebuild the database.
 
The FK constraint info can be found by joining the following system tables:

- RDB$RELATION_CONSTRAINTS
- RDB$REF_CONSTRAINTS


Martijn Tonies
Database Workbench - the developer tool for InterBase, Firebird, MySQL & MS SQL Server
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top