从负数转换为UNSIGNED

时间:2014-05-08 13:24:24

标签: mysql

mysql> SELECT CAST(-6 AS UNSIGNEd);
+----------------------+
| CAST(-6 AS UNSIGNEd) |
+----------------------+
| 18446744073709551610 |
+----------------------+
1 row in set (0.00 sec)

mysql> SELECT CAST(6 AS UNSIGNEd);
+---------------------+
| CAST(6 AS UNSIGNEd) |
+---------------------+
|                   6 |
+---------------------+
1 row in set (0.00 sec)

mysql> SELECT CAST(6 AS CHAR)
    -> ;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    126
Current database: *** NONE ***

+-----------------+
| CAST(-6 AS CHAR) |
+-----------------+
| -6               |
+-----------------+
1 row in set (0.02 sec)

什么转型机制?

0 个答案:

没有答案