zzzprojects / Bulk-Operations

C# SQL Bulk Operations | High-performance C# bulk insert, update, delete and merge for SQL Server, SQL Azure, SQL Compact, MySQL, and SQLite.
https://bulk-operations.net
142 stars 34 forks source link

When Insert/Update bulk data, columns not included who has default value in SQL #71

Closed SinanBarut26 closed 2 years ago

SinanBarut26 commented 2 years ago

Example table

TblExample { ID INT NOT NULL UserName VARCHAR(50) NULL IsActive SMALLINT CONSTRAINT [DF_TblScanQueue_QueueStatus] DEFAULT ((0)) NOT NULL }

IsActive set from Constrains by default.

When I send bulk insert to this table and watch on sql profiler. I did't see IsActive field on execute bulk operation

System Info: SQL Server 15.0 .Net Core 3.1 Z.EntityFramework.Extensions.EFCore 3.13.4

JonathanMagnan commented 2 years ago

Hello @SinanBarut26 ,

Could you try with the option ForceValueGeneratedStrategy?

By default, our library lets the database populate the IsActive column when there is a default value like in this case. Using the ForceValueGeneratedStrategy will tell our library to take the one your specified.

Let me know if that worked.

Best Regards,

Jon

JonathanMagnan commented 2 years ago

Hello again,

Since our last conversation, we haven't heard from you.

Let me know if you need further assistance.

Best regards,

Jon

JonathanMagnan commented 2 years ago

Hello @SinanBarut26 ,

A simple reminder that we are here to assist you.

Let me know if the solution provided worked for you.

Dont hesitate to contact us for more information.

Best regards,

Jon

SinanBarut26 commented 2 years ago

Sorry for the late response. It works for me. Thank you for your help.

JonathanMagnan commented 2 years ago

Great to hear!

Don't hesitate to contact us for further assistance.

Best regards,

Jon