exception - Error handling with SqlBulkCopy - could it be any harder? -


There is very little going on the ideas here I have found a case where I have to pump data into a DB SqlBulkCopy I am using, and about halfway through, I go into different exceptions (primary key violation, index violation, etc.).

I have confirmed that the violation is really true and the need to improve the data is irrelevant, however, it is that if I am writing DAB with Data Adapter (which will be slow) If so, the hedgers will turn into bad rows in the dataset so that I can easily find them and take care of things. With SqlBulkCopy? nothing. Nada. Anyone who causes your problem, is a good luck to find because all you get is an error name (such as "More than usual, a major violation in the case, blah blah blah") and that's it.

Any suggestions? I do not believe there is no way to get these errors. With standard BCP I think you can pump these things in the log file as well. Can not we do something like this that has Sclabulcopy?

thx,

Take a look at the source code for SqlBulkCopy - The answer will be there - there is no real error handling.

One thing you can do, though the lame you have to do, set the batch to 1 with the batch size to run one.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -