Using SQLBulkCopy to Insert/Update database

前端 未结 4 1814
遥遥无期
遥遥无期 2020-12-10 14:51

I have a datatable with the records.I\'m inserting records into Sql table using SqlBulkCopy.It works fine.Next time when get the datatable with same records with few changed

4条回答
  •  爱一瞬间的悲伤
    2020-12-10 15:42

    Avoid Truncate table and Create a new temporary table, which BTW consume more space and memory.

    I created a Trigger with INSTEAD OF INSERT and use inside MERGE statement.

    But don't forget add the parameter SqlBulkCopyOptions.FireTriggers in the SqlBulkCopy.

    This is my two cents.

提交回复
热议问题