1292截断的INTEGER值不正确

时间:2017-05-19 19:00:01

标签: mysql sql integer mariadb mysql-error-1292

我没看到什么?我不知道为什么我会收到这个错误。它甚至不应该要求整数。

MariaDB [ams]> describe server_current_status;
+----------+-------------+------+-----+---------+----------------+
| Field    | Type        | Null | Key | Default | Extra          |
+----------+-------------+------+-----+---------+----------------+
| id       | int(11)     | NO   | PRI | NULL    | auto_increment |
| serverid | varchar(20) | YES  |     | NULL    |                |
| status   | varchar(20) | YES  |     | NULL    |                |
| notify   | varchar(15) | YES  |     | NULL    |                |
| totime   | varchar(20) | YES  |     | NULL    |                |
| fromtime | varchar(20) | YES  |     | NULL    |                |
+----------+-------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)

MariaDB [ams]> UPDATE server_current_status SET notify = 'SOME' AND status = 'DOWN' WHERE serverid = '8';
Query OK, 0 rows affected, 2 warnings (0.04 sec)
Rows matched: 1  Changed: 0  Warnings: 2

MariaDB [ams]> show warnings;
+---------+------+-------------------------------------------+
| Level   | Code | Message                                   |
+---------+------+-------------------------------------------+
| Warning | 1292 | Truncated incorrect INTEGER value: 'SOME' |
| Warning | 1292 | Truncated incorrect DOUBLE value: 'SOME'  |
+---------+------+-------------------------------------------+
2 rows in set (0.00 sec)

1 个答案:

答案 0 :(得分:3)

notify = 'SOME' AND status = 'DOWN'

这是一个布尔表达式。引擎将其读为

notify = ('SOME' AND (status = 'DOWN'))

因此引擎尝试将'SOME'转换为布尔值(在MySQL / MariaDB中为01

你可能想要这个:

notify = 'SOME', status = 'DOWN'
相关问题