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

后端 未结 6 2060
青春惊慌失措
青春惊慌失措 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:54

    I would bulk load data into a temporary staging table, then do an upsert into the final table. See http://www.databasejournal.com/features/mssql/article.php/3739131/UPSERT-Functionality-in-SQL-Server-2008.htm for an example of doing an upsert.

提交回复
热议问题