Topic: PRAGMA instruction on attached database

Hello Dmitry,


For upgrading purposes of databases generated by MVD, I need to set

     SQLExecute('PRAGMA foreign_keys=OFF');

and then return the foreign key constraints back to normal with

     SQLExecute('PRAGMA foreign_keys=ON');

This works on the main MVD database (the one attached by default), but if I attach a second database name (for example) OLD_DB, how do I run that query specifying it should impact the attached database and not the default one ?


Thanks in advance


Cheers


Mathias

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor

Re: PRAGMA instruction on attached database

Mathias,
Did you try this:

SQLExecute('ATTACH DATABASE ''Old_Db.db'' as ''Old''');
    SQLExecute('PRAGMA Old.foreign_keys=OFF');

Re: PRAGMA instruction on attached database

Hello ehwagner,


If feel totally dumb not to have thought about this combination. I have tried a lot of them but not this one.


Thanks you my friend, works like a charm smile


Math

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor