cancel
Showing results for 
Search instead for 
Did you mean: 

disable foreign key constraints temporarily

Former Member
0 Kudos

Hi everybody,

I am trying to implement a db restore function in the HANA Cloud which uses MaxDB.

For this, I have a complete xml based db backup which I upload to my HANA Cloud application.

Since I am very (100%) sure that this backup is valid regarding foreign key constraints, I simply

want to execute insert statements one after another.

During this process I insert records with foreign ids which haven't been inserted yet, which leads

to SQLExceptions.. (Integrity Errors)

some SQL databases have the possibility to disable those constraints checks temporarily with

SET foreign_key_checks = 0;

// do the import

SET foreign_key_checks = 1;

or

ALTER TABLE foo NOCHECK CONSTRAINT ALL;

// do the import

ALTER TABLE foo CHECK CONSTRAINT ALL;

or

ALTER TABLE foo DISABLE KEYS;

but none of those statements work.

Does anyone know what the MaxDB SQL command for this kind of functionality is?

Many thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi David,

there is no command to disable the constraints definitions

Burkhard

Former Member
0 Kudos

Thanks Burkhard!  This is very unfortunate.. how do you do a bulk insert on a table with one field being a self-relation without inserting in the correct order / hierarchy ? Is there another way? How do you restore backups in your systems? You should have the same issues.. right?

Answers (0)