MySQL提示Truncated incorrect DOUBLE value解决方法
原创
©著作权归作者所有:来自51CTO博客作者beifu的原创作品,请联系作者获取转载授权,否则将追究法律责任
这篇文章给大家介绍了MySQL提示Truncated incorrect DOUBLE value报错的四种解决方法,并通过代码给大家介绍的非常详细,具有一定的参考价值,需要的朋友可以参考下
“Truncated incorrect DOUBLE value”
的解决方法主要是这四种
:
1、修改了多个列的值而各列之间用逗号连接而不要用and
错误写法示例:
1 |
update tablename set col1=value1 and col2=value2 where col3=value3;
|
正确写法示例:
1 |
update tablename set col1=value1,col2=value2 where col3=value3;
|
2、SQL语句在拼接字符串时使用函数CONCAT()而不要用“+”
3、单数引号问题
1 |
String sql= "UPDATE arrange SET askForLeave='是' WHERE employeeNum=“+employeeNum+” and arrangeDate=" +leaveDate;
|
改成了
1 |
String sql= "UPDATE arrange SET askForLeave='是' WHERE employeeNum='" +employeeNum+ "' and arrangeDate='" +leaveDate+ "'"
|
在字符串变量前后加了单引号
4、在查询时查询条件的类型和字段类型不符
到此这篇关于MySQL提示Truncated incorrect DOUBLE value解决方法的文章就介绍到这了