Fire trigger for every inserted row using SqlBulkCopy

前端 未结 4 1071
清歌不尽
清歌不尽 2021-01-19 03:31

I am using SqlBulkCopy class to insert 50k rows at a time in table tbl_records I have set a After Insert trigger on this table and usi

4条回答
  •  迷失自我
    2021-01-19 04:24

    The SqlBulkCopy object's batch size is the full set of rows, by default.

    Here's what MSDN says about the BatchSize property values: "Zero (the default) indicates that each WriteToServer operation is a single batch."

    In this case, the trigger will fire once, but the Inserted table will have entries for all of the affected records.

提交回复
热议问题