Dump multiple tables with foreign keys

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
siik
Posts: 10
Joined: Fri 12 Jun 2009 06:10

Dump multiple tables with foreign keys

Post by siik » Fri 12 Jun 2009 06:25

Hi,

I am trying to dump three tables from my database to file. I have used the tMSDump component which can backuptofile() and restorefromfile().
Table3 references table2, and table2 references table1.

Backuptofile() works fine.

The problem i am having is:

I cannot restorefromfile() in any order(table3 first/table1 first), because the TRUNCATE statement in the dump file always fails (which it should because it violates the FK rule).

So i cant really find a solution to dump these three tables into one file. I guess i need to

A: turn the FK constraint off before restoring or
B: Dump all tables at once (i.e. truncate all tables then restore in correct order - 1,2,3 so FK are preserved)

but i cant see an option for this in the TMSDump component. I am sure someone else wouldve had to do this before, so any help is appreciated.

Regards

Dimon
Devart Team
Posts: 2888
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 12 Jun 2009 12:37

Thank you for your inquiry. At present SDAC does not support such functionality. We will investigate the possibility of adding this functionality in the near future. As soon as we solve this question we will let you know.

Dimon
Devart Team
Posts: 2888
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 01 Jul 2009 08:12

We have added the TMSDump.Options.DisableConstraints property to dump multiple tables with foreign keys in the latest SDAC build (4.70.0.48).

Post Reply