TCRBatchMove workaround

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ertank
Posts: 172
Joined: Wed 13 Jan 2016 16:00

TCRBatchMove workaround

Post by ertank » Tue 23 May 2017 15:48

Hello,

Using UniDAC 7.0.2.

As far as I know TCRBatchMove identify primary key in a TDataSet automatically. I would like to know if there is any way to provide primary key columns manually.

I am using TCRBatchMove between two detail tables. Both detail table's primary key is set on an autoincrement column. I would like to define TCRBatchMove to use two columns where second column is master link column. This will help me get rid of wrong append/update of records between source and destination because of different autoincrement column values in a multi-user environment.

Thanks.

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: TCRBatchMove workaround

Post by azyk » Fri 26 May 2017 10:03

TCRBatchMove does not allow setting custom values for IDENTITY fields. For the issue solution, you can use TUniloader. In order for TUniloader to pass values of a primary key from a source table to the IDENTITY field of a destination table, set TUniLoader.SpecificOptions.Values['SQL Server.KeepIdentity'] to True. For data loading use the TUniLoader.LoadFromDataSet method.

More details about KeepIdentity: https://www.devart.com/unidac/docs/?sql ... tuniloader and TUniLoader: https://www.devart.com/unidac/docs/?dev ... loader.htm

Post Reply