System.Data.SqlClient.SqlBulkCopy.BatchSize Property

Number of rows in each batch. At the end of each batch, the rows in the batch are sent to the server.

Syntax

public int BatchSize { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

A batch is complete when SqlBulkCopy.BatchSize rows have been processed or there are no more rows to send to the destination data source.

Zero (the default) indicates that each erload:System.Data.SqlClient.SqlBulkCopy.WriteToServer operation is a single batch.

If the System.Data.SqlClient.SqlBulkCopy instance has been declared without the SqlBulkCopyOptions.UseInternalTransaction option in effect, rows are sent to the server SqlBulkCopy.BatchSize rows at a time, but no transaction-related action is taken. If SqlBulkCopyOptions.UseInternalTransaction is in effect, each batch of rows is inserted as a separate transaction.

The SqlBulkCopy.BatchSize property can be set at any time. If a bulk copy is already in progress, the current batch is sized according to the previous batch size. Subsequent batches use the new size. If the SqlBulkCopy.BatchSize is initially zero and changed while a erload:System.Data.SqlClient.SqlBulkCopy.WriteToServer operation is already in progress, that operation loads the data as a single batch. Any subsequent erload:System.Data.SqlClient.SqlBulkCopy.WriteToServer operations on the same System.Data.SqlClient.SqlBulkCopy instance use the new SqlBulkCopy.BatchSize.

Requirements

Namespace: System.Data.SqlClient
Assembly: System.Data (in System.Data.dll)
Assembly Versions: 2.0.0.0