You could use the GO
command. That will restart the execution of SQL statements after an error. In my case I have a few 1000 INSERT statements, where a handful of those records already exist in the database, I just don't know which ones.
I found that after processing a few 100, execution just stops with an error message that it can't INSERT
as the record already exists. Quite annoying, but putting a GO
solved this. It may not be the fastest solution, but speed was not my problem.
GO
INSERT INTO mytable (C1,C2,C3) VALUES(1,2,3)
GO
INSERT INTO mytable (C1,C2,C3) VALUES(4,5,6)
etc ...