Fire trigger for every inserted row using SqlBulkCopy

前端 未结 4 1072
清歌不尽
清歌不尽 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:21

    Triggers never fire per-row. They fire for all rows of the corresponding DML statement. Rewrite your trigger so that it can cope with the INSERTED table containing many rows. This is best-practice and required practice anyway.

    it is firing trigger for only first row inserted out of 50k rows

    You must be misinterpreting the situation, maybe because you were unaware that triggers can contain multiple rows in the virtual tables.

提交回复
热议问题