Sql error 1292

MySQL error 1292 occurs if the syntax for the date entered is incorrect or when trying to compare a number and a string in a WHERE or ON clause.

MySQL error 1292 occurs if the syntax for the date is incorrectly entered.

Here at Bobcares, we have seen several causes for this error while troubleshooting MySQL issues as part of our Server Management Services for web hosts and online service providers.

Today we’ll take a look at the cause for this error and how to fix it.

Why does MySQL Error 1292 occur

Before we get into the solution part, let us first see what causes this error to occur.

This error normally occurs when the date is entered in an incorrect format. The date value like 0000-00-00 00:00:00 is not allowed with MySQL 5.7 version.

Also, this error can occur when trying to compare a number and a string in a WHERE or ON clause.

For instance, the error appears as below.

MySQL Error 1292

How we fix MySQL Error 1292

This error is of different types and can occur due to many reasons and also the solution will differ according to the error. Here are the different errors and the solutions that our Engineers provide to our customers.

1. If a field type is a DATE, then we make sure that the date is entered in the format “yyyy-mm-dd”.

2. Error Code: 1292 – Incorrect date value

Many of our customers use MySQL 5.7. But in this version date value like 0000-00-00 00:00:00 is not allowed. Hence, the above error occurs. In case, if our customers want to allow it, then we update their my.cnf like:

sudo nano /etc/mysql/my.cnf

In this file, we find

[mysqld]

Then after that, we add the below line.

sql_mode=”NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”

After adding the above line, we restart the MySQL service. For that, we run the below command.

sudo service mysql restart

3. #1292 – Truncated incorrect DOUBLE value

Usually, this error message appears when customers try to compare a number and a string in a WHERE or ON clause.

So we make sure that they have similar declarations or convert the number to a string. Also, if we turn off strict mode, the error turns into a warning.

[Need any further assistance in fixing MySQL errors? – We’re available 24*7]

Conclusion

In short, this error can arise with different messages and has its own way to fix it. Today, we saw the resolution to this MySQL error.

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.

GET STARTED

var google_conversion_label = «owonCMyG5nEQ0aD71QM»;

The MySQL error Truncated incorrect DOUBLE value is one of the weirdest errors in MySQL.

This is because the error can be caused by some mistakes in your SQL script that has nothing to do with a DOUBLE value.

The error is mostly triggered when there’s a mistake in UPDATE statements script.

Let’s see some example scripts that trigger the error. Suppose you have a database named students with the following data:

+----+---------+---------+-------+--------+-------------+
| id | name    | subject | score | gender | student_id  |
+----+---------+---------+-------+--------+-------------+
|  1 | Sarah   | Math    |     9 | male   | 12937254892 |
|  2 | Natalia | Math    |     8 | female | 08936A58421 |
|  3 | Christ  | English |     4 | male   | 87463X98107 |
+----+---------+---------+-------+--------+-------------+

One of the mistakes that could trigger the Truncated incorrect DOUBLE value error is when you use the AND clause when updating multiple columns of the table.

The script would look as follows:

UPDATE students 
  SET name = 'Sarah' 
    AND score = 9
  WHERE id = '1';
ERROR 1292 (22007): Truncated incorrect DOUBLE value: 'Sarah'

While the error is because of the AND clause, the error description will make you think that there’s something wrong with the value 'Sarah'.

To fix the error, you need to replace the AND clause with a comma:

UPDATE students 
  SET name = 'Sarah',
    score = 9
  WHERE id = '1';

-- Query OK, 0 rows affected (0.00 sec)
-- Rows matched: 1  Changed: 0  Warnings: 0

Another thing that could trigger this error is if you try to compare a string value that has no number representation with a number value in the WHERE clause.

An example wrong statement could be as shown below:

UPDATE students 
  SET score = 5
  WHERE student_id = 87463298107;

The error response would look as follows:

ERROR 1292 (22007): Truncated incorrect DOUBLE value: '08936A58421'

The error above is because there’s an entry in the student_id table that has no equal number value representation.

The student_id column is a VARCHAR column that can contain a string type of alphanumeric characters or a number type of numeric characters.

When you create a comparison in the WHERE clause that uses the number type, then MySQL will try to convert the column’s string type to number type for the comparison.

In the case of our example, the second row of the student_id column has no equal number value representation:

+-------------+
| student_id  |
+-------------+
| 12937254892 |
| 08936A58421 |
| 87463298107 |
+-------------+

The letter 'A' in the second row value causes MySQL unable to cast the value as an integer and do a comparison.

To fix the error, you need to wrap the value in the WHERE clause with quotation marks:

UPDATE students 
  SET score = 5
  WHERE student_id = '87463298107';

-- Query OK, 0 rows affected (0.00 sec)
-- Rows matched: 1  Changed: 0  Warnings: 0

Interestingly, MySQL won’t throw the same error when you run a SELECT statement:

SELECT * FROM students
  WHERE student_id = 87463298107;

The above query would return the result set without an error:

+----+--------+---------+-------+--------+-------------+
| id | name   | subject | score | gender | student_id  |
+----+--------+---------+-------+--------+-------------+
|  3 | Christ | English |     4 | male   | 87463298107 |
+----+--------+---------+-------+--------+-------------+

And those are some SQL script mistakes that can trigger the Truncated incorrect DOUBLE value error.

As you can see, the error can be triggered even when you don’t have any column of DOUBLE type or a DOUBLE value in your scripts.

If you found this error and are unable to find what’s wrong with your statements, then I suggest you check if the types used by your columns are the same as the types in your statements.

If you’re using VARCHAR type in your column, then it’s better to compare the column value with a string even though it looks like a number.

When there are values of different types, you can explicitly convert one of the values to match the other using the CAST() function.

Good luck in fixing the error! 👍

Содержание

  1. How to fix MySQL ‘Truncated incorrect DOUBLE value’ error
  2. Level up your programming skills
  3. About
  4. MySQL Error 1292 – Solve it now
  5. Why does MySQL Error 1292 occur
  6. How we fix MySQL Error 1292
  7. Conclusion
  8. PREVENT YOUR SERVER FROM CRASHING!
  9. 2 Comments
  10. Неполадки с базой данных
  11. Недоступность базы данных
  12. Повреждены таблицы БД (Table is marked as crashed)
  13. Ошибка 2006: MySQL server has gone away
  14. Ошибка 1040: Too many connections
  15. Ошибка 1292: Incorrect date value
  16. Truncated Incorrect Double Value in MySQL
  17. mysqlimport Error 1292. Incorrect datetime value
  18. Проблема
  19. Разбираемся
  20. Решение
  21. Вариант 2
  22. Вариант 3
  23. И вишенка на торте!

How to fix MySQL ‘Truncated incorrect DOUBLE value’ error

Posted on Nov 07, 2021

Learn how to fix MySQL ‘Truncated incorrect DOUBLE value’ error 1292

The MySQL error Truncated incorrect DOUBLE value is one of the weirdest errors in MySQL.

This is because the error can be caused by some mistakes in your SQL script that has nothing to do with a DOUBLE value.

The error is mostly triggered when there’s a mistake in UPDATE statements script.

Let’s see some example scripts that trigger the error. Suppose you have a database named students with the following data:

One of the mistakes that could trigger the Truncated incorrect DOUBLE value error is when you use the AND clause when updating multiple columns of the table.

The script would look as follows:

While the error is because of the AND clause, the error description will make you think that there’s something wrong with the value ‘Sarah’ .

To fix the error, you need to replace the AND clause with a comma:

Another thing that could trigger this error is if you try to compare a string value that has no number representation with a number value in the WHERE clause.

An example wrong statement could be as shown below:

The error response would look as follows:

The error above is because there’s an entry in the student_id table that has no equal number value representation.

The student_id column is a VARCHAR column that can contain a string type of alphanumeric characters or a number type of numeric characters.

When you create a comparison in the WHERE clause that uses the number type, then MySQL will try to convert the column’s string type to number type for the comparison.

In the case of our example, the second row of the student_id column has no equal number value representation:

The letter ‘A’ in the second row value causes MySQL unable to cast the value as an integer and do a comparison.

To fix the error, you need to wrap the value in the WHERE clause with quotation marks:

Interestingly, MySQL won’t throw the same error when you run a SELECT statement:

The above query would return the result set without an error:

And those are some SQL script mistakes that can trigger the Truncated incorrect DOUBLE value error.

As you can see, the error can be triggered even when you don’t have any column of DOUBLE type or a DOUBLE value in your scripts.

If you found this error and are unable to find what’s wrong with your statements, then I suggest you check if the types used by your columns are the same as the types in your statements.

If you’re using VARCHAR type in your column, then it’s better to compare the column value with a string even though it looks like a number .

When there are values of different types, you can explicitly convert one of the values to match the other using the CAST() function.

Good luck in fixing the error! 👍

Level up your programming skills

I’m sending out an occasional email with the latest programming tutorials. Drop your email in the box below and I’ll send new stuff straight into your inbox!

About

Nathan Sebhastian is a software engineer with a passion for writing tech tutorials.
Learn JavaScript and other web development technology concepts through easy-to-understand explanations written in plain English.

Источник

MySQL Error 1292 – Solve it now

MySQL error 1292 occurs if the syntax for the date is incorrectly entered.

Here at Bobcares, we have seen several causes for this error while troubleshooting MySQL issues as part of our Server Management Services for web hosts and online service providers.

Today we’ll take a look at the cause for this error and how to fix it.

Why does MySQL Error 1292 occur

Before we get into the solution part, let us first see what causes this error to occur.

This error normally occurs when the date is entered in an incorrect format. The date value like 0000-00-00 00:00:00 is not allowed with MySQL 5.7 version.

Also, this error can occur when trying to compare a number and a string in a WHERE or ON clause.

For instance, the error appears as below.

How we fix MySQL Error 1292

This error is of different types and can occur due to many reasons and also the solution will differ according to the error. Here are the different errors and the solutions that our Engineers provide to our customers.

1. If a field type is a DATE, then we make sure that the date is entered in the format “yyyy-mm-dd”.

2. Error Code: 1292 – Incorrect date value

Many of our customers use MySQL 5.7. But in this version date value like 0000-00-00 00:00:00 is not allowed. Hence, the above error occurs. In case, if our customers want to allow it, then we update their my.cnf like:

In this file, we find

Then after that, we add the below line.

After adding the above line, we restart the MySQL service. For that, we run the below command.

3. #1292 – Truncated incorrect DOUBLE value

Usually, this error message appears when customers try to compare a number and a string in a WHERE or ON clause.

So we make sure that they have similar declarations or convert the number to a string. Also, if we turn off strict mode, the error turns into a warning.

[Need any further assistance in fixing MySQL errors? – We’re available 24*7]

Conclusion

In short, this error can arise with different messages and has its own way to fix it. Today, we saw the resolution to this MySQL error.

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.

ERROR 1292 (22007): Incorrect date value: ’24-02-2020′ for column ‘date’ at row 1

Hi,
Please contact our support team via live chat(click on the icon at right-bottom).

Источник

Неполадки с базой данных

При работе с базами данных могут встречаться ошибки. Ниже перечислены частые ошибки и меры по их диагностике и устранению.

Недоступность базы данных

Необходимо подключиться к серверу по SSH и выполнить следующие проверки:

1. Проверить, запущена ли служба MySQL:

Пример вывода для запущенной службы:

Если в выводе отсутствует слово running, служба не запущена. В этом случае необходимо попытаться ее запустить:

После этого надо проверить работу сайта и сделать следующую проверку, если ошибка сохраняется.

2. Проверить состояние дискового пространства.

Просмотреть общий и занятый объем на диске командой:

Доступное пространство должно быть на основном разделе. Если свободное пространство закончилось, необходимо освободить место или перейти на тариф выше. Для работы с дисковым пространством можно использовать утилиты ncdu или du.

Если на диске достаточно свободного места, но ошибка сохраняется, надо проверить состояние inodes.

Если не удается решить ошибку самостоятельно, то нужно обратиться в техническую поддержку.

Повреждены таблицы БД (Table is marked as crashed)

При возникновении ошибок вида «Warning: Table . is marked as crashed» необходимо выполнить восстановление таблиц.

Если на сервере установлен phpMyAdmin, можно выполнить восстановление с его помощью. Для этого необходимо:

  1. перейти в интерфейс PMA,
  2. выбрать нужную базу данных в меню слева,
  3. отметить в списке таблицы, которые нужно восстановить — то есть таблицы, имена которых фигурируют в ошибках,
  4. в самом низу страницы нажать на выпадающее меню «С отмеченными» и выбрать вариант «Восстановить».

Без phpMyAdmin можно выполнить необходимые действия при подключении по SSH. Для восстановления одной таблицы нужно выполнить команду:

Для восстановления всех таблиц в базе используется команда:

Также можно выполнить проверку всех таблиц в базе с помощью команды:

Ошибка 2006: MySQL server has gone away

Ошибка MySQL server has gone away означает, что сервер закрыл соединение. Это происходит, как правило, в двух случаях: превышение таймаута ожидания или получение сервером слишком большого пакета.

В обоих случаях для устранения ошибки потребуется внести правки в конфигурационный файл MySQL. Это делается при подключении к серверу по SSH или с помощью веб-консоли в панели управления.

Конфигурационный файл может располагаться по различным путям, например:

Чтобы определить, в какой файл необходимо вносить изменения, можно использовать команду вида:

Например:
grep -Rl ‘wait_timeout’ /etc/*

или:
grep -Rl ‘max_allowed_packet’ /etc/*

С ее помощью можно выяснить, в каких файлах прописан нужный параметр, и изменить в них его значение.

Чтобы увеличить таймаут ожидания, необходимо скорректировать значение параметра wait_timeout

Нужно открыть конфигурационный файл с помощью редактора, обязательно указав корректный путь к файлу:

Далее нужно изменить значение параметра wait_timeout на более высокое. Значение указывается в секундах: чтобы увеличить время ожидания до 10 минут, необходимо указать значение 600:

После перезапустить службу MySQL:

Скорректировать максимально допустимый размер пакетов можно увеличением параметра max_allowed_packet.

Нужно открыть конфигурационный файл с помощью редактора, обязательно указав корректный путь к файлу:

Дале нужно изменить значение параметра max_allowed_packet на более высокое (значение указывается в мегабайтах):

После перезапустить службу MySQL:

Ошибка 1040: Too many connections

Ошибка «Too many connections» означает, что исчерпан лимит подключений к базе данных. Ошибка связана с медленными запросами, которые выполняются слишком долго (в этом случае требуется оптимизация кода) либо в числе одновременных подключений. В этом случае можно попробовать решить проблему увеличением лимита подключений (параметр max_connections) в конфигурационном файле MySQL.

В пункте выше было описано, как определить расположение файла my.cnf.

Следует открыть конфигурационный файл с помощью редактора, обязательно указав корректный путь к файлу:

И заменить значение параметра на более высокое, например:

max_connections = 200

После перезапустить службу MySQL:

Ошибка 1292: Incorrect date value

При попытке добавить данные в таблицу MySQL без указания даты может выдаваться ошибка:

Из-за этой ошибки может нарушаться работа импорта в 1С.

Для исправления ошибки необходимо:

1.Открыть файл /etc/mysql/my.cnf:

2. В строке, начинающейся с sql-mode=, удалить следующие значения:

NO_ZERO_IN_DATE

NO_ZERO_DATE

STRICT_ALL_TABLES

3. Выполнить перезагрузку mysql-сервера:

Если строка вида sql-mode= отсутствует, необходимо:

Источник

Truncated Incorrect Double Value in MySQL

In this tutorial, we aim at exploring how to fix the error: Truncated Incorrect Double Value.

There are many different types of errors one might face while writing complex MySQL queries. These errors are usually assigned a particular error code with them. The truncated incorrect double value is one of these errors with the error code 1292 . The exact error can be illustrated as 1292 — Truncated incorrect DOUBLE value: .

One of the main reasons for this error is due to incorrect usage of the UPDATE SET clause. The UPDATE SET clause updates information for a particular table. The set keyword helps assign specific values to a column. The basic syntax for this clause can be illustrated as follows.

In the syntax above, name_of_table represents the table to be changed. SET represents the column name and the value that needs to be set based on a particular condition in the where statement.

We get the 1292 error in MySQL because sometimes, programmers write incorrect syntax, which can be illustrated as follows.

To solve the error associated with the code above, we simply have to get rid of the and in between the two-column names specified. This operation can be illustrated as follows.

Therefore, with the help of the correct UPDATE SET technique, we can efficiently eliminate the truncated incorrect double value error in MySQL.

Preet writes his thoughts about programming in a simplified manner to help others learn better. With thorough research, his articles offer descriptive and easy to understand solutions.

Источник

mysqlimport Error 1292. Incorrect datetime value

Проблема

Имеется база данных с заранее подготовленной структурой. Сервер БД — mariadb-10.5.8. В результате импорта данных из CSV-дампа mailing_views_details.txt (создан при помощи mysqldump —tab)

где
-d — очистка таблицы mailing_views_details перед ипортированием
-k — отключить проверку foreign key во время импортирования
-v — добавляет немного «болтливости» при импорте

в таблицу mailing_views_details получаю следующую ошибку:

Loading data from SERVER file: mailing_views_details.txt into mailing_views_details
mysqlimport Error 1292, Incorrect datetime value: ‘2018-03-25 03:01:08’ for column `test`.`mailing_views_details`.`created_at` at row 706660, when using table: mailing_views_details

Разбираемся

Смотрим строку 706660 и соседнюю с ней 706659 дампа mailing_views_details.txt

507967 15550 2018-03-25 02:59:22
450087 15559 2018-03-25 03:01:08

Значение третьего поля ‘2018-03-25 03:01:08’ недопустимо из-за перехода на летнее время (Daylight saving time (DST)) между 2 и 3 часами ночи 25 марта. Следовательно все значения времени после 3 часов ночи в любой день введения летнего времени недопустимы. Это утверждение истинно если тип поля таблицы timestamp

Решение

Их есть несколько

  1. Сменить системный часовой пояс на тот, который не использует DST
  2. Изменить тип поля таблицы с текущего timestamp на datetime
  3. Задать другое значение переменной mysqltime_zone

Ясно, что первый вариант вовсе и не вариант для нашего часового пояса. Поэтому рассмотрим варианты два и три

Вариант 2

Меняем тип поля таблицы mailing_views_details на datetime

После чего дамп накатывается без ошибок

Вариант 3

Меняем переменную time_zone с текущего значения SYSTEM на +2:00

И накатываем дамп. Чтобы всякий раз после перезагрузки mysql не изменять значение time_zone на нужное, необходимо в файле my.cnf добавить следующее:

И вишенка на торте!

Такая ошибка импортирования наблюдается только в случае если дамп был сделан с использованием mysqldump —tab в CSV-файл. Если же дампить без опции —tab, то при заливке подобной ошибки не возникает

Источник

При работе с базами данных могут встречаться ошибки. Ниже перечислены частые ошибки и меры по их диагностике и устранению.

  • Недоступность базы данных
  • Повреждены таблицы БД (Table is marked as crashed)
  • Ошибка 2006: MySQL server has gone away
  • Ошибка 1040: Too many connections
  • Ошибка 1292: Incorrect date value

Недоступность базы данных

Необходимо подключиться к серверу по SSH и выполнить следующие проверки:

1. Проверить, запущена ли служба MySQL:

service mysql status

Пример вывода для запущенной службы:

Если в выводе отсутствует слово running, служба не запущена. В этом случае необходимо попытаться ее запустить:

service mysql start

После этого надо проверить работу сайта и сделать следующую проверку, если ошибка сохраняется.

2. Проверить состояние дискового пространства.

Просмотреть общий и занятый объем на диске командой:

df -h

Доступное пространство должно быть на основном разделе. Если свободное пространство закончилось, необходимо освободить место или перейти на тариф выше. Для работы с дисковым пространством можно использовать утилиты ncdu или du.

Если на диске достаточно свободного места, но ошибка сохраняется, надо проверить состояние inodes.

Если не удается решить ошибку самостоятельно, то нужно обратиться в техническую поддержку.

Повреждены таблицы БД (Table is marked as crashed)

При возникновении ошибок вида «Warning: Table … is marked as crashed» необходимо выполнить восстановление таблиц.

Если на сервере установлен phpMyAdmin, можно выполнить восстановление с его помощью. Для этого необходимо:

  1. перейти в интерфейс PMA,
  2. выбрать нужную базу данных в меню слева,
  3. отметить в списке таблицы, которые нужно восстановить — то есть таблицы, имена которых фигурируют в ошибках,
  4. в самом низу страницы нажать на выпадающее меню «С отмеченными» и выбрать вариант «Восстановить».

Без phpMyAdmin можно выполнить необходимые действия при подключении по SSH. Для восстановления одной таблицы нужно выполнить команду:

mysqlcheck -r имя_базы имя_таблицы -uroot -p

Для восстановления всех таблиц в базе используется команда:

mysqlcheck -r имя_базы -uroot -p

Также можно выполнить проверку всех таблиц в базе с помощью команды:

mysqlcheck -r -A -uroot -p

Ошибка 2006: MySQL server has gone away

Ошибка MySQL server has gone away означает, что сервер закрыл соединение. Это происходит, как правило, в двух случаях: превышение таймаута ожидания или получение сервером слишком большого пакета.

В обоих случаях для устранения ошибки потребуется внести правки в конфигурационный файл MySQL. Это делается при подключении к серверу по SSH или с помощью веб-консоли в панели управления.

Конфигурационный файл может располагаться по различным путям, например:

/etc/my.cnf
/etc/mysql/my.cnf
/etc/mysql/mysql.conf.d/mysqld.cnf

Чтобы определить, в какой файл необходимо вносить изменения, можно использовать команду вида:

grep -Rl ‘имя_параметра’ /etc/*

Например:
grep -Rl ‘wait_timeout’ /etc/*

или:
grep -Rl ‘max_allowed_packet’ /etc/*

С ее помощью можно выяснить, в каких файлах прописан нужный параметр, и изменить в них его значение.

Таймаут

Чтобы увеличить таймаут ожидания, необходимо скорректировать значение параметра wait_timeout

Нужно открыть конфигурационный файл с помощью редактора, обязательно указав корректный путь к файлу:

nano /etc/mysql/my.cnf

Далее нужно изменить значение параметра wait_timeout на более высокое. Значение указывается в секундах: чтобы увеличить время ожидания до 10 минут, необходимо указать значение 600:

wait_timeout = 600

После перезапустить службу MySQL:

service mysql restart

Размер пакетов

Скорректировать максимально допустимый размер пакетов можно увеличением параметра max_allowed_packet.

Нужно открыть конфигурационный файл с помощью редактора, обязательно указав корректный путь к файлу:

nano /etc/mysql/my.cnf

Дале нужно изменить значение параметра max_allowed_packet на более высокое (значение указывается в мегабайтах):

max_allowed_packet = 64M

После перезапустить службу MySQL:

service mysql restart

Ошибка 1040: Too many connections

Ошибка «Too many connections» означает, что исчерпан лимит подключений к базе данных. Ошибка связана с медленными запросами, которые выполняются слишком долго (в этом случае требуется оптимизация кода) либо в числе одновременных подключений. В этом случае можно попробовать решить проблему увеличением лимита подключений (параметр max_connections) в конфигурационном файле MySQL.

В пункте выше было описано, как определить расположение файла my.cnf.

Следует открыть конфигурационный файл с помощью редактора, обязательно указав корректный путь к файлу:

nano /etc/mysql/my.cnf

И заменить значение параметра на более высокое, например:

max_connections = 200

После перезапустить службу MySQL:

service mysql restart

Ошибка 1292: Incorrect date value

При попытке добавить данные в таблицу MySQL без указания даты может выдаваться ошибка:

ERROR 1292 (22007): Incorrect date value: ‘0000-00-00’ for column ‘columnname’ at row 1

Из-за этой ошибки может нарушаться работа импорта в 1С.

Для исправления ошибки необходимо:

1.Открыть файл /etc/mysql/my.cnf:

nano /etc/mysql/my.cnf

2. В строке, начинающейся с sql-mode=, удалить следующие значения:

NO_ZERO_IN_DATE

NO_ZERO_DATE

STRICT_ALL_TABLES

3. Выполнить перезагрузку mysql-сервера:

sudo service mysql restart

Примечание:

Если строка вида sql-mode= отсутствует, необходимо:

1. В файл /etc/mysql/my.cnf после параметра [mysqld] добавить строку:

sql-mode=»ONLY_FULL_GROUP_BY,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION»

2. Выполнить перезагрузку mysql-сервера:

sudo service mysql restart
 

  1. HowTo
  2. MySQL Howtos
  3. Truncated Incorrect Double Value in …
Truncated Incorrect Double Value in MySQL

In this tutorial, we aim at exploring how to fix the error: Truncated Incorrect Double Value.

There are many different types of errors one might face while writing complex MySQL queries. These errors are usually assigned a particular error code with them. The truncated incorrect double value is one of these errors with the error code 1292. The exact error can be illustrated as 1292 - Truncated incorrect DOUBLE value: <Exact Error Location>.

One of the main reasons for this error is due to incorrect usage of the UPDATE SET clause. The UPDATE SET clause updates information for a particular table. The set keyword helps assign specific values to a column. The basic syntax for this clause can be illustrated as follows.

UPDATE name_of_table 
SET column_name = <value>
WHERE <condition>;

In the syntax above, name_of_table represents the table to be changed. SET represents the column name and the value that needs to be set based on a particular condition in the where statement.

We get the 1292 error in MySQL because sometimes, programmers write incorrect syntax, which can be illustrated as follows.

UPDATE name_of_table 
SET column_name_1 = <value_1> and column_name_2 = <value_2>  
WHERE <condition>;

To solve the error associated with the code above, we simply have to get rid of the and in between the two-column names specified. This operation can be illustrated as follows.

UPDATE name_of_table 
SET column_name_1 = <value_1>, column_name_2 = <value_2>  
WHERE <condition>;

Therefore, with the help of the correct UPDATE SET technique, we can efficiently eliminate the truncated incorrect double value error in MySQL.

Preet Sanghavi avatar
Preet Sanghavi avatar

Preet writes his thoughts about programming in a simplified manner to help others learn better. With thorough research, his articles offer descriptive and easy to understand solutions.

LinkedIn
GitHub

Related Article — MySQL Query

  • Sort MySQL Data in Alphabetical Order
  • Enable Slow Query Log in MySQL
  • Calculate Percentage in MySQL
  • Where vs Having in MySQL
  • Nested Select Statements in MySQL for Enhanced Query
  • Tiny Integer in MySQLEzoic
  • Понравилась статья? Поделить с друзьями:
  • Sql error 1248 42000 every derived table must have its own alias
  • Sql error internal jdbc driver error
  • Sql error 1205 sqlstate 40001
  • Spring security login error
  • Sql error handling