Any way to SQLBulkCopy “insert or update if exists”?

后端 未结 6 2031
青春惊慌失措
青春惊慌失措 2020-11-28 09:10

I need to update a very large table periodically and SQLBulkCopy is perfect for that, only that I have a 2-columns index that prevents duplicates. Is there a way to use SQLB

6条回答
  •  有刺的猬
    2020-11-28 09:56

    Not in one step, but in SQL Server 2008, you could:

    • bulk load into staging table
    • apply a MERGE statement to update/insert into your real table

    Read more about the MERGE statement

提交回复
热议问题