ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

SqlBulkCopy

2022-06-30 15:32:04  阅读:160  来源: 互联网

标签:rows BatchSize object SqlBulkCopy batch data


SqlBulkCopy Class

BatchSize

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

BulkCopyTimeout

Number of seconds for the operation to complete before it times out.

ColumnMappings

Returns a collection of SqlBulkCopyColumnMapping items. Column mappings define the relationships between columns in the data source and columns in the destination.

DestinationTableName

Name of the destination table on the server.

EnableStreaming

Enables or disables a SqlBulkCopy object to stream data from an IDataReader object.

NotifyAfter

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.

 

SqlBulkCopy.BulkCopyTimeout 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.

 

SqlBulkCopy.EnableStreaming Property

Property Value

Boolean

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

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有