Skip error while bulk inserting
I am using following query to bulk insert from one table to another.
INSERT INTO billitems SELECT * FRO开发者_C百科M billitems_old;
I want that if insert fails on any row, it must skip that row and proceed. Is there anything that I can include in the above query to skip errors.
insert ignore into billitems select * from billitems_old;
reference: insert
From the online documentation:
If you use the IGNORE keyword, errors that occur while executing the INSERT statement are treated as warnings instead.
So try:
INSERT IGNORE INTO billitems SELECT * FROM billitems_old
精彩评论