博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Continue SQL query even on errors
阅读量:6851 次
发布时间:2019-06-26

本文共 708 字,大约阅读时间需要 2 分钟。

try

mysql --force < sample_data.sql
Mysql help section says
 -f, --force         Continue even if we get an sql error.
----------------------
You could also use INSERT IGNORE
INSERT IGNORE INTO mytable
 (primaryKey, field1, field2)
VALUES
 ('1', 1, 2),
 ('1', 3, 4), //will not be inserted
 ('2', 5, 6); //will be inserted
----------------------
You can use INSERT... IGNORE syntax if you want to take no action when there's a duplicate record.
You can use REPLACE INTO syntax if you want to overwrite an old record with a new one with the same key.
Or, you can use INSERT... ON DUPLICATE KEY UPDATE syntax if you want to perform an update to the record instead when you encounter a duplicate.
----------------------

 

REF:

转载地址:http://dwyyl.baihongyu.com/

你可能感兴趣的文章
利用HTML5将摄像头视频流转换成ascii码流,通过websocket实时传输给其它浏览器展示。...
查看>>
运维之道:16 张图片带你 1 小时学会 Ansible
查看>>
分享:IT管理员都喜欢用的Outlook超大附件系统
查看>>
objective-c设计模式之---单例
查看>>
golang读取json格式的天气预报
查看>>
每周一书《大数据搜索引擎原理分析及编程实现》分享!
查看>>
【网优谷】如何快速写出有吸引力的网站标题?
查看>>
Linux运维之lLinux文件系统及文件类型
查看>>
网站SEO优化过程中什么样的文章容易被秒收
查看>>
stata初学者常用命令语
查看>>
tomcat的安装
查看>>
深入理解并行编程4
查看>>
Internet Connection speeds
查看>>
puppet运维自动化之puppet模块示例
查看>>
如何让云×××:VIS Creator 带给您一个市场领先的私有云管理平台
查看>>
获取各个ISP运营商IP地址修正版[菜鸟级]
查看>>
python核心编程--第五章
查看>>
我的友情链接
查看>>
关于Mac系统中SequelPro工具对于Mysql数值类型nt(M)存值的bug
查看>>
Linux下重置MySQL的Root帐号密码
查看>>