2017-05-19 1 views
1

Que ne vois-je pas? Je ne sais pas pourquoi je reçois cette erreur. Il ne devrait même pas demander un nombre entier.1292 Valeur incorrecte INTEGER tronquée

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

Deviner. Comma oublié. Il y a un "ET" où il devrait y avoir une virgule –

Répondre

3
notify = 'SOME' AND status = 'DOWN' 

Ceci est une expression booléenne. Le moteur se lit comme quelque chose comme

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

Ainsi, le moteur tente de convertir 'SOME' à un booléen (qui est 0 ou 1 dans MySQL/MariaDB)

Vous voulez sans doute ceci:

notify = 'SOME', status = 'DOWN'