Continue SQL query even on errors
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://stackoverflow.com/questions/5366436/continue-sql-query-even-on-errors
Continue SQL query even on errors的更多相关文章
- jstl中的sql:query标签获取的结果如何格式化输出
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...
- .net连接DB2的异常SQL0666 - SQL query exceeds specified time limit or storage limit.错误处理
SQL0666 - SQL query exceeds specified time limit or storage limit. 原因:查询超时 解决办法: set the DbCommand.C ...
- NHibernate系列文章二十六:NHibernate查询之SQL Query查询(附程序下载)
摘要 NHibernate在很早的版本就提供了SQL Query(原生SQL查询),对于很复杂的查询,如果使用其他的查询方式实现比较困难的时候,一般使用SQL Query.使用SQL Query是基于 ...
- Freebie - Utility Form: Generate Excel Report From SQL Query In Oracle Forms 6i And 11g
Sharing a form to generate Excel file report from SQL query in Oracle Forms. This form can be used i ...
- jasper ireport create a report with parameters without sql query
I'm new in jasper ireport , and I want to know if it is possible to create a report only with static ...
- 使用JSTL的sql:query标签制作分页查询遇到NoSuchFieldError: deferredExpression
参考:http://hi.baidu.com/desyle/item/4fe650265792d7182a0f1c33 症状: 如题所述,代码如下 <sql:query var="re ...
- REP-20147 Cannot implement column link for this detail SQL query. Converting to group link.
注:本文为原创,作为学习交流使用,转载请标明作者及出处,作者保留追究法律责任的权力. Lumen Su lzsu1989#gmail.com (#=@) www.cnblogs.com/lzsu198 ...
- EntityFramework 学习 一 Execute Native SQL Query
SQL query for entity types: using (var ctx = new SchoolDBEntities()) { var studentList = ctx.Student ...
- Entity Framework Tutorial Basics(39):Raw SQL Query
Execute Native SQL Query You can execute native raw SQL query against the database using DBContext. ...
随机推荐
- Content-Negotiation Header Quality Values
HTTP: The Definitive Guide 17.3.2 Content-Negotiation Header Quality Values The HTTP protocol define ...
- Linux磁盘分区工具的使用
----------fdisk分区工具---------- 一..下面来介绍fdisk分区工具的命令格式: fdisk是传统的Linux硬盘分区工具,也是Linux系统中最常用的一种硬盘分区 ...
- Java8 新特性之Lambda表达式
1. Lambda 表达式概述 Lambda 是一个匿名函数,我们可以把 Lambda 表达式理解为是一段可以传递的代码(将代码像数据一样进行传递); Lambda 表达式可以写出更简洁,更灵活的代码 ...
- Cache与主存之间的全相联映射,直接映射和组相联映射的区别
2017-02-22 注:本文并非原创,来自百度文库,只是觉得写得较好,故分享之.若是某人的知识产权,望告知!谢谢 1.高速缓冲存储器的功能.结构与工作原理 高速缓冲存储器是存在于主存与CPU之间的一 ...
- 如何用Qt Creator输出helloworld
0 引言:相比于MFC只要直接在VS上搭建,Qt的配置就相对复杂了,Qt新手上路,老司机绕道,记录下配置Qt的整个过程,直到最终用C++输出“hello world”. 搭建环境:Win10 + qt ...
- maven加载第三方jar包
<dependency> <groupId>com.yeepay</groupId> <artifactId>yop-sdk</artifactI ...
- Linux系统性能调优之性能分析
1.Linux性能分析的目的1)找出系统性能瓶颈(包括硬件瓶颈和软件瓶颈):2)提供性能优化的方案(升级硬件?改进系统系统结构?):3)达到合理的硬件和软件配置:4)使系统资源使用达到最大的平衡.(一 ...
- 009-Shell 函数
一.函数定义 linux shell 可以用户定义函数,然后在shell脚本中可以随便调用. shell中函数的定义格式如下: [ function ] funname [()] { action; ...
- Oracle中to_number()函数的用法
to_number()函数是oracle中常用的类型转换函数之一,是将一些处理过的按一定格式编排过的字符串变回数值型的格式. 1.to_number()函数可以将char或varchar2类型的str ...
- math.h函数库
C语言中之数学函数 C语言提供了以下的数学函数,要使用这些函数时,在程序文件头必须加入: #include <math.h> 编译时,必须加上参数「-lm」(表示连结至数学函式库),例如「 ...