If your insertions are idempotent, update or replace
will help you.
Given that they are most likely not, there is no super-efficient way to do this without returning to inserting individual lines as a backup - to isolate the problem line.
If you are inserting inserts to reduce the latency from the client to the server, consider using a stored procedure to take the rows and insert into the server side it takes all the data in the frame; which may have a backup that performs appropriate error handling line by line.
This assumes, of course, that there is significant error handling that can be performed on the server side without the need for synchronous communication with the client.
source share