SQLTeam.com | Weblogs | Forums

Avoid Duplication in SqlBulkCopy from .Net

bulk-insert

#1

I am using VB.Net for bulk insert.
but i don't want to make it insert duplicate rows,

it is large table so i can not use Insert statement

Provide any solution for this.
Example will be appreciated.


#2

you can use the INSERT statement, just do it in batches. to avoid duplicates, you'll need to sort the input first and filter out duplicates or else query the destination table for each row going into the batch, though I think sorting may be faster overall.

Alternatively, use SSIS, which eats this kind of problem for lunch


#3

Thanks for showing interest,
but can't use insert statement because of too much records (approx 1000 per transaction),
IGNORE_DUP_KEY=ON Solved Problem for me.
Using Bulk Copy