Ignore mysql error messages when executing an sql file

前端 未结 2 1568
名媛妹妹
名媛妹妹 2021-01-25 09:58

I am copying records from one table to another and there is a chance that some records may already be in the second table i am copying the records to.

Since there are lo

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-25 10:32

    As documented under INSERT Syntax:

    The INSERT statement supports the following modifiers:

    [ deletia ]
    • If you use the IGNORE keyword, errors that occur while executing the INSERT statement are treated as warnings instead. For example, without IGNORE, a row that duplicates an existing UNIQUE index or PRIMARY KEY value in the table causes a duplicate-key error and the statement is aborted. With IGNORE, the row still is not inserted, but no error is issued.

提交回复
热议问题