CRBatchMove and Identity Columns

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
tinof
Posts: 39
Joined: Fri 16 Dec 2005 07:41

CRBatchMove and Identity Columns

Post by tinof » Thu 11 Oct 2012 09:29

Hello,

i want to update an program written with SDAC 3.xxx to actual SDAC version.
In this program i use CRBatchMove for copying table data.
Some of the tables have an identity - column.
So i execute an "set identity_insert [tablename] on" bevore executing crbatchmove.
In the old version it works.
In the new version (6.2.8) it fails because the crbatchmove automaticly does not include the identity column in the insert - code.

How can i tell crbatchmove, that i want ALL columns, even the identity column too?

Within the mappings - property i do assign the identity column to a source column.
But if i look the final code with SQL profiler i see, the identity column is missed.
So the server can't insert the data.

SQL Server 2008 R2 / Delphi XE2

Thanks for Help
Tino

AndreyZ

Re: CRBatchMove and Identity Columns

Post by AndreyZ » Thu 11 Oct 2012 10:45

Hello,

To solve the problem, you should set the SetFieldsReadOnly option of the destination dataset to False.

tinof
Posts: 39
Joined: Fri 16 Dec 2005 07:41

Re: CRBatchMove and Identity Columns

Post by tinof » Thu 11 Oct 2012 14:07

That's the solution, thank you very much.

Now it works!

Tino

AndreyZ

Re: CRBatchMove and Identity Columns

Post by AndreyZ » Thu 11 Oct 2012 14:47

If any other questions come up, please contact us.

Post Reply