BulkCopy or Insert ignoring Primary key

  • Thread starter Thread starter arnoled
  • Start date Start date
A

arnoled

I want to make a bulkcopy (or insertcommand if this can't be
acomplished with bulk copy) to a table. But if there are rows that are
already in the table, just ignore them (don't do the insert on that
row) , so i doesn't raise an exception of Violation of Primary Key.

I don't want to bring the whole table from de the database, that would
be very low performant.

If you know any option to do these directly form .net it would be
great, any suggestion is welcome

thanks
 
Hello arnoled,

<snip>

I admit your problem is not entirely clear to me. Of course you could
write an algorithm that would insert data in the way you describe, but
that would probably not be very performant. It seems to me you are asking
this question in relation to a particular feature that the database
backend you are using has, but then you don't mention what database that
is or what feature you're talking about. Hm.... otherwise, how do you
arrive at the conclusion that there would be such a feature in the first
place?

So, if there is actually such a feature in your database of choice, and
it's based on SQL, and you have an ADO.NET driver for that database, you
should easily be able to use the feature through the standard DB commands.

Finally, if all that doesn't help you at all, please feel free to post
some more explanation :-)


Oliver Sturm
 
Back
Top