Re: Order of Table Creation and Foreign Keys
Date: 1995/11/29
Message-ID: <DItMyy.GMM_at_gateway.deltec.com>#1/1
diamond_at_pavilion.co.uk (diamond) wrote:
>Can any gurus help with this simple question ?
>
>I am creating a small d/b (about 10 tables) and have written and tested the
>SQL scripts to create and populate each table. When I try to add Foreign Keys
>to some tables, I get error message 'Cannot Add Referential Constraint - Parent Keys
>Not Found'.
>
>I think this is something to do with the order in which I create the tables and Primary Keys
>thereon. Is this the case ?
>
>Also, does anyone know a 'foolproof' method for deriving a Table Craetion Order from
>(say) a basic E-R diagram ?
>
>Thanks in advance
>
>Robin Farr
>diamond_at_pavilion.co.uk
>
Create all your tables w/ primary keys first, then issue alter table statements to add foreign keys. Data Modeling tools like S-Designor use this approach to generate DB creation scripts.
-- Henry Ballen Senior Database Administrator Information Services Dept. Phone: 612 628-7156 SIMS Deltec, Inc. MS6570 Fax: 612 639-2530 St. Paul, MN 55112 E-mail: hballen_at_deltec.comReceived on Wed Nov 29 1995 - 00:00:00 CET