执行update语句mysql5.6报错ERROR 1292 (22007): Truncated incorrect DOUBLE value: '糖糖的坤大叔'

执行修改语句update tbl_user_details set nickname=CONCAT("用户",yunva_id) where nickname = yunva_id;





报错:

ERROR 1292 (22007): Truncated incorrect DOUBLE value: '糖糖的坤大叔'





查看sql模式

mysql> show session variables like '%sql_mode%';

+---------------+--------------------------------------------+

| Variable_name | Value                                      |

+---------------+--------------------------------------------+

| sql_mode      | STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION |

+---------------+--------------------------------------------+

1 row in set (0.00 sec)



mysql> update tbl_user_details set nickname=CONCAT("用户",yunva_id) where nickname = yunva_id;

ERROR 1292 (22007): Truncated incorrect DOUBLE value: '糖糖的坤大叔'



解决办法:设置sql_mode为非严格模式,问题解决



mysql> set sql_mode='NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';

Query OK, 0 rows affected (0.00 sec)





mysql> show session variables like '%sql_mode%';

+---------------+--------------------------------------------+

| Variable_name | Value                                      |

+---------------+--------------------------------------------+

| sql_mode      | NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |

+---------------+--------------------------------------------+

1 row in set (0.00 sec)





mysql> update tbl_user_details set nickname=CONCAT("用户",yunva_id) where nickname = yunva_id;

Query OK, 101622 rows affected, 14594 warnings (2.65 sec)

Rows matched: 101622  Changed: 101622  Warnings: 14594

上一篇:工作随笔记 点击除div自身之外的地方,关闭自己


下一篇:使用excel中的数据快速生成sql语句