MySQL 'Truncated incorrect INTEGER value'

前端 未结 6 1459
野趣味
野趣味 2020-12-11 01:57

I\'m getting an odd \'Truncated incorrect INTEGER value\' error when I run the following UPDATE query:

update tbl
set projectNumber = right(comments, 7)
wher         


        
6条回答
  •  旧时难觅i
    2020-12-11 02:44

    I found one solution, which is out of box and could easily be implemented. The solution is much similar to SET ANSI_WARNING OFF in MS SQL Server.

    In MySQL, first you need to check whether what is configurations is set for "sql_mode" by using below command:

    SHOW VARIABLES LIKE 'sql_mode';
    

    OR else use below:

    SELECT @@GLOBAL.sql_mode;
    

    There might have following sets of value in CSV.

    ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

    Based on your error, you can remove settings and Reset it using below command:

    SET GLOBAL sql_mode = 'ONLY_FULL_GROUP_BY,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
    

    By using above command to reset it. It has solved similar of this problem "Truncated incorrect INTEGER value" in my case. I hope it should be working from other user also who are facing this issue.

    For more details on this "sql_mode", please refer this.

    Hope this would be use full!

提交回复
热议问题