执行修改语句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

相关文章:

  • 2022-12-23
  • 2021-10-16
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-24
  • 2021-10-12
  • 2021-11-05
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案