Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Disabling constraints in DB2

 
M Burke
Ranch Hand
Posts: 406
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 381
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic