I increased the int(250) …
不,你没有:对于所有整数类型,该值不会增加字段大小 - 如果字段还具有 ZEROFILL 标志,则只会增加显示宽度。
CREATE TABLE `ints` (
`tinyint1` tinyint(1) unsigned zerofill DEFAULT NULL,
`tinyint4` tinyint(4) unsigned zerofill DEFAULT NULL,
`int11` int(11) unsigned zerofill DEFAULT NULL,
`bigint30` bigint(30) unsigned zerofill DEFAULT NULL
);
INSERT INTO ints VALUES (1, 1, 1, 1);
INSERT INTO ints VALUES (5, 5, 5, 5);
INSERT INTO ints VALUES (10, 10, 10, 10);
INSERT INTO ints VALUES (100, 100, 100, 100);
INSERT INTO ints VALUES (10212072467628961, 10212072467628961, 10212072467628961, 10212072467628961);
ERROR 1264 (22003): Out of range value for column 'tinyint1' at row 1
INSERT INTO ints VALUES (0, 0, 0, 10212072467628961);
SELECT * FROM ints;
+----------+----------+-------------+--------------------------------+
| tinyint1 | tinyint4 | int11 | bigint30 |
+----------+----------+-------------+--------------------------------+
| 1 | 0001 | 00000000001 | 000000000000000000000000000001 |
| 5 | 0005 | 00000000005 | 000000000000000000000000000005 |
| 10 | 0010 | 00000000010 | 000000000000000000000000000010 |
| 100 | 0100 | 00000000100 | 000000000000000000000000000100 |
| 0 | 0000 | 00000000000 | 000000000000010212072467628961 |
+----------+----------+-------------+--------------------------------+
5 rows in set (0.01 sec)
正如其他人所建议的,您必须使用不同的整数类型:
http://dev.mysql.com/doc/refman/5.0/en/integer-types.html
“增加”有效范围的唯一方法是使用 UNSIGNED 标志并省略所有负值 - 但从技术上讲,这是范围的移动,而不是增加。技术上。