Question

Is there a way to do a bulk insert in Sql Server where rows with errors are skipped rather than the whole process failing? I don't mean just keeping those rows inserted prior to the error; I mean inserting all rows that aren't errored.

Was it helpful?

Solution

If you use SSIS, you can redirect the Error Output of the Destination to a garbage Script Component or a flat file. I often do that so I can then examine the rows that went awry.

Additionally, if you're using BULK INSERT, then you can use the MAX_ERRORS (setting it to a very high value) and ERROR_FILE parameters to specify how to handle errors effectively.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top