SqlBulkCopy
作者:互联网
Sql Bulk Copy Class
Batch |
Number of rows in each batch. At the end of each batch, the rows in the batch are sent to the server. |
Bulk |
Number of seconds for the operation to complete before it times out. |
Column |
Returns a collection of SqlBulkCopyColumnMapping items. Column mappings define the relationships between columns in the data source and columns in the destination. |
Destination |
Name of the destination table on the server. |
Enable |
Enables or disables a SqlBulkCopy object to stream data from an IDataReader object. |
Notify |
Defines the number of rows to be processed before generating a notification event. |
BatchSize
Remarks
A batch is complete when BatchSize rows have been processed or there are no more rows to send to the destination data source.
Zero (the default) indicates that each WriteToServer operation is a single batch.
If the SqlBulkCopy instance has been declared without the UseInternalTransaction option in effect, rows are sent to the server BatchSize rows at a time, but no transaction-related action is taken. If UseInternalTransaction is in effect, each batch of rows is inserted as a separate transaction.
The 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 BatchSize is initially zero and changed while a WriteToServer operation is already in progress, that operation loads the data as a single batch. Any subsequent WriteToServer operations on the same SqlBulkCopy instance use the new BatchSize.
Sql Bulk Copy. Bulk Copy Timeout Property
The integer value of the BulkCopyTimeout property. The default is 30 seconds. A value of 0 indicates no limit; the bulk copy will wait indefinitely.
Remarks
If the operation does time out, the transaction is not committed and all copied rows are removed from the destination table.
Sql Bulk Copy. Enable Streaming Property
Property Value
true
if a SqlBulkCopy object can stream data from an IDataReader object; otherwise, false. The default is false
.
Remarks
When EnableStreaming is true
, SqlBulkCopy reads from an IDataReader object using SequentialAccess, optimizing memory usage by using the IDataReader streaming capabilities. When it's set to false, the SqlBulkCopy class loads all the data returned by the IDataReader object into memory before sending it to SQL Server or SQL Azure.
标签:rows,BatchSize,object,SqlBulkCopy,batch,data 来源: https://www.cnblogs.com/chucklu/p/16427081.html