Re: Order of Table Creation and Foreign Keys

From: Randy Dewoolfson <randyd_at_cais3.cais.com>
Date: 1995/11/27
Message-ID: <49bb66$dmr_at_zippy.cais.net>#1/1


diamond (diamond_at_pavilion.co.uk) 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 the tables and constraints in any order you like. populate the tables.
THEN enable the constraints.
Whenever you must do table maintenance (DROP, EXPORT, IMPORT etc) 1st DISABLE the constraints (Dont drop them) then do your table thing - Then re-enable the constraints.

Good Luck
Randy :)

--
    ..uu.                                     ----------------------
  .?$" '?i     .                              I  Randy DeWoolfson  I
 .T^M  ._at_"    d9    .     f   ,.un.  b,    i  I--------------------I
 "  Z :#"    M `8   U    <  .dP"``"# `M   _at_"  I  randyd_at_cais.com   I
    &H?`    Xl _R   $5.  $  ?*    _at_   'P,#"   I--------------------I
  ,d#^*L   :RP'~$b  f`$L:M  Xf  .f'    dH`    I        ,\//.       I
    &  'M ,P    `E  M   "$  Mux~      n!`     I        |o o|       I
   dk   `h"       ' j     " y"       *~       I====oOO==(_)==Ooo===I
Received on Mon Nov 27 1995 - 00:00:00 CET

Original text of this message