A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
The Software Craftsman
this week in the
JDBC and Relational Databases
Disabling constraints in DB2
Joined: Jun 25, 2004
Jan 06, 2006 10:15:00
I am making a JDBC-based application that generates sql scripts to migrate data between databases (even between db vendors). I have one for SQL2000, now I need one for DB2.
The schema has foreign key (FK) constraints, so the mass import needs to shut this off before calling sql insert statements.
In SQL2000, I use this command to disable FK constraints:
ALTER TABLE APPTABLENAME NOCHECK CONSTRAINT ALL;
This does not work in DB2. It does not like the "NOCHECK" part. Anyone know I can fix this?
[ January 06, 2006: Message edited by: M Burke ]
Maximilian Xavier Stocker
Joined: Sep 20, 2005
Jan 06, 2006 16:55:00
Don't know for DB2. Probably your best source of info would be the DB2 documentation.
One thing that would be a more generic solution would be to drop the key and add it back upon completion.
rocket mass heater
subject: Disabling constraints in DB2
hibernate disable foreign keys
Regarding Foreign Key Restricts when Alter data type in sql table
howto create foreign key in mySQL ?
Importing data into a database with a complex schema using Java
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015