MySQL Forums
Forum List  »  Chinese

ERROR 1292 (22007): Truncated incorrect DOUBLE value
Posted by: maplechow Chow
Date: August 22, 2013 12:30PM

ERROR 1292 (22007): Truncated incorrect DOUBLE value

表是这样
> desc prop;
+---------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+-------------+------+-----+---------+----------------+
| proid | int(10) | NO | PRI | NULL | auto_increment |
| cityid | int(2) | NO | | 0 | |
| content_basic | varchar(32) | NO | | | |
| content_other | text | YES | | NULL | |
| updated | int(10) | YES | | 0 | |
+---------------+-------------+------+-----+---------+----------------+

简单的一条query,故意写错
> update prop set content_basic='aa' and content_other='bb' where proid=17011445;
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1

> show warnings;
+---------+------+----------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------+
| Warning | 1292 | Truncated incorrect DOUBLE value: 'aa' |
+---------+------+----------------------------------------+
1 row in set (0.00 sec)

> select * from prop;
+----------+--------+---------------+---------------+------------+
| proid | cityid | content_basic | content_other | updated |
+----------+--------+---------------+---------------+------------+
| 17011445 | 11 | 0 | bb | 1377185448 |
+----------+--------+---------------+---------------+------------+

问题是就算被Truncated ,为什么content_basic字段会被changed 为0呢?想不通Mysql为啥这样设计,有的情况下会让人很闷。

有哪位大神可以帮忙解释下?

Options: ReplyQuote


Subject
Views
Written By
Posted
ERROR 1292 (22007): Truncated incorrect DOUBLE value
19189
August 22, 2013 12:30PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.