Batch Insert

When we do a batch insert of about 1000 records and if any one record fails in between, is there any way that we ignore that particular record and have other records inserted succesfully.

Please suggest if there is any other smart method to handle this.

Thank You


no that is not possible (as far as i know). Maybe it is a good idea to validate your data before inserting, because then you know that all your fields have the right content/lenght and the insert will be always successfull.


You can write a service to submit and commit each row to the database individually. That way if any fails, all other rows are still processed.

I agree with Rob’s suggestion,thats the cleaner way to go…

If you use insert row by row and commit process then processing/perfomance wise its not a good idea…


Validating your data before hand will work if you can guarantee that there will still be no database insert failure with the valid data (i.e. duplicate row exception).

The performance will definitely degrade with single insert/commit operations, but at least you know the data will go in for 999 of the 1000 rows, and you can catch the errors of why that 1 row didn’t commit.

Just my two cents,