解决sql update 1292 - Truncated incorrect DOUBLE value:

来源:互联网 发布:淘宝二手单反哪家靠谱 编辑:程序博客网 时间:2024/05/29 10:18
  • 在数据库批量修改字符串的值,语句如下

      update jc_content_picture set img_path="/jeecms"+img_path where 1=1

  • 执行后提示如下

        err  1292 - Truncated incorrect DOUBLE value: 'jeecms'

  • 解决:

     在sql语句进行字符串拼接时,不是我们习惯的使用“+”,而是使用mysql自带的字符拼接 函数concat(str1,str2,...),将上面sql改为

     update jc_content_picture set img_path=CONCAT("/jeecms",img_path) where 1=1;

    可以正常执行

0 0