Are you frustrated with the MySQL Truncated incorrect double value error message? Our MySQL Support team is here to lend a hand with your queries and issues.
Resolved: MySQL Truncated incorrect double value
If you have been coming across the MySQL error Truncated incorrect DOUBLE value, you are in luck. Our experts are here to help you out.
Interestingly, this error is often due to errors in the SQL script rather than a Double value issue.
Hence, you may see the error even if you don’t have a column of DOUBLE type or a DOUBLE value in the scripts.
In other words, the error pops up when there is an issue in the UPDATE statements script.
For instance, let’s take a look at the following example:
+----+---------+---------+-------+--------+-------------+
| id | name | subject | score | gender | student_id |
+----+---------+---------+-------+--------+-------------+
| 1 | Jenny | English | 98 | male | 64937254892 |
| 2 | Ali | Math | 87 | male | 36936B58421 |
| 3 | Bob | English | 64 | male | 71463T98107 |
+----+---------+---------+-------+--------+-------------+
This is a database of 3 students with their corresponding marks in different subjects.
Now suppose, we run the following script:
UPDATE students
SET name = 'Jenny'
AND score = 98
WHERE id = '1';
This will result in the following error message:
ERROR 1292 (22007): Truncated incorrect DOUBLE value: ‘Jenny’
This is due to the AND clause in the script. We can easily resolve the error by replacing the AND clause with a comma.
Another reason behind the MySQL Truncated incorrect double value message is comparing a string value that does not contain a number representation with a number value in the WHERE clause.
For example:
UPDATE students
SET score = 57
WHERE student_id = 71463298107;
In this scenario, the error occurs due to an entry in the table that has no equal number value representation. We can resolve the error in this scenario by wrapping the value in the WHERE clause with quotation marks.
Furthermore, if we have used VARCHAR type in a column, our experts recommend comparing the column value with a string although it looks like a number.
Additionally, we can use the CAST() function to convert one of the values to match the other.
Let us know in the comments which one of our tips helped your resolve the incorrect double value error.
[Need assistance with a different issue? Our team is available 24/7.]
Conclusion
To wrap things up, our Support Engineers demonstrated how the MySQL Truncated incorrect double value error message can also be caused by script errors.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
hi there, how to solve for the following case, where the ‘-‘ are possible values in a column that are otherwise numbers
create table qJGoY4Cydq3FgDzI as
select
‘-‘ as test1,
ifnull( cast( ‘-‘ as double ), null) as test2
the target column for test2 is to be double, where non-casted values are preferred to be rendered ‘null’
thx!
Herman
Hello Herman,
Please contact our support team via live chat(click on the icon at right-bottom).