Copy tables

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Petya
Posts: 21
Joined: Wed 28 Jul 2010 11:24

Copy tables

Post by Petya » Wed 28 Jul 2010 14:36

Hello,

I wonder what's the simplest way to copy a table from one SQL Server to another replacing the destination, using SDAC 4.80.

Thanks, Peter

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

Post by Dimon » Wed 28 Jul 2010 15:51

You can use the TCRBatchMove component to copy data from one database to another.
You can find more detailed information about TCRBatchMove in the SDAC Help.

Petya
Posts: 21
Joined: Wed 28 Jul 2010 11:24

Post by Petya » Wed 28 Jul 2010 17:19

Tomorrow I'll try it.
Thanks !

Petya
Posts: 21
Joined: Wed 28 Jul 2010 11:24

Post by Petya » Fri 30 Jul 2010 17:10

It works fine, thanks.
Except for that I set
CRBatchMove1.AbortOnKeyViol:=false;
CRBatchMove1.AbortOnProblem:=false;
and it still stops and throws exceptions on such conditions.
Cannot it be overrided some way ?

Thanks, Peter

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

Post by Dimon » Mon 02 Aug 2010 08:52

Please give a more detailed description of the error that arises in your application.

Petya
Posts: 21
Joined: Wed 28 Jul 2010 11:24

Post by Petya » Mon 02 Aug 2010 16:11

Hi Dimon,

Unfortunately I don't have time momently to investigate this, therefore I solved it another way, regarding the fact that even 1 error makes my process to be unsuccessful.

My other question is there any way to stop the batchmove process programmatically during operation, for example using the OnBatchMoveProgress event ? I didn't find such method in the manual.

Thanks a lot,

Peter

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

Post by Dimon » Tue 03 Aug 2010 08:38

TCRBatchMove doesn't allow to stop process after starting execution.
But you can use the RecordCount property to determine the maximum number of records in the source dataset, that will be applied to the destination dataset.

Petya
Posts: 21
Joined: Wed 28 Jul 2010 11:24

Post by Petya » Tue 03 Aug 2010 08:42

Hi Dimon,

Can I tell TCRBatchMove to start over where it has left off anyway ?

Thanks for your answer,

Peter

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

Post by Dimon » Tue 03 Aug 2010 12:06

Set the RecordCount property. If RecordCount is greater than 0, up to the RecordCount records are applied to the destination dataset, starting from the current record in the source dataset.

Petya
Posts: 21
Joined: Wed 28 Jul 2010 11:24

Post by Petya » Tue 03 Aug 2010 12:53

So if I do nothing else to the DataSets than call Execute (optionally) again with RecordCount>0 until RecordCount>MovedCount, that's enough ? This method is safe enough ?

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

Post by Dimon » Tue 03 Aug 2010 13:23

Yes, you can use this method.

Post Reply