db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Watts <...@cliftonfarm.org>
Subject Re: Importing tables which have references to other tables
Date Fri, 15 Jun 2012 12:24:01 GMT
On Fri, 2012-06-15 at 08:18 -0400, Tim Watts wrote:
> On Thu, 2012-06-14 at 23:26 -0700, jaz1988 wrote:
> > Hi,
> > 
> > I have a table, TABLE1 which has a column which is GENERATED BY DEFAULT AS
> > IDENTITY. I managed to export this table and import into an existing DB with
> > the same table. The import is able to adjust the IDENTITY column accordingly
> > with regards to the existing data in the table. 
> > 
> > The problem is, I have another table, TABLE2 which has a foreign key that
> > referenced to the IDENTITY column in TABLE1. When the IDENTITY column in
> > TABLE1 is adjusted after import, the import of TABLE2 will fail since the
> > References is messed up already. Am I doing it right or is there other ways
> > to do import and exports of Tables with references.
> > 
> > Thank you!
> Since you specified BY DEFAULT that means you can import TABLE1 using
> the existing id values so that when you import TABLE2 you shouldn't have
> any referential integrity issues.  But, of course, you'll want to export
> the id values from TABLE1.
> I was able to do this using Derby's SYSCS_UTIL.SYSCS_IMPORT_DATA
> procedure.
Let me further point out that you should read the fine print for
generated-column-spec in the Derby SQL manual under Create Table /
column-definition / generated-column-spec, especially the part about
using a START WITH clause.

View raw message