执行sql文件时忽略mysql错误信息 [英] Ignore mysql error messages when executing an sql file

查看:198
本文介绍了执行sql文件时忽略mysql错误信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将记录从一个表复制到另一个表,并且有可能某些记录可能已经在我将记录复制到的第二个表中.

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.

由于我正在复制很多行,我正在寻找一种方法来忽略来自 mysql 的所有记录已经存在的消息并继续执行 mysql 文件.

Since there are lots of rows i am copying,i am looking a way to ignore all the record already exists messages from mysql and continue executing the mysql file.

有什么办法可以抑制错误消息?.

Is there a way i can suppress the error messages?.

推荐答案

<下所述code>INSERT 语法:

INSERT 语句支持以下修饰符:

The INSERT statement supports the following modifiers:

[ deletia ]

  • 如果您使用 IGNORE 关键字,则在执行 INSERT 语句被视为警告.例如,如果没有 IGNORE,重复表中现有 UNIQUE 索引或 PRIMARY KEY 值的行会导致重复键错误,并且语句被中止.使用 IGNORE,该行仍然没有插入,但没有发出错误.
    • 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.
    • 这篇关于执行sql文件时忽略mysql错误信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆