MySQL Error 1264: out of range value for column

2019-01-14 05:33发布

As I SET cust_fax in a table in MySQL like this:

cust_fax integer(10) NOT NULL,

and then I insert value like this:

INSERT INTO database values ('3172978990');

but then it say

`error 1264` out of value for column

And I want to know where the error is? My set? Or other?

Any answer will be appreciated!

4条回答
太酷不给撩
2楼-- · 2019-01-14 05:50

Use unsigned. int = from 0 to 4294967295

or VARCHAR

查看更多
三岁会撩人
3楼-- · 2019-01-14 05:58

You can also change the data type to bigInt and it will solve your problem, it's not a good practice to keep integers as strings unless needed. :)

ALTER TABLE T_PERSON MODIFY mobile_no BIGINT;
查看更多
你好瞎i
4楼-- · 2019-01-14 06:08

The integer 3172978990 is greater than 2147483647, hence the error**.

To fix the error, change your datatype to VARCHAR. Phone, Fax etc. should be stored as strings. See this discussion.

** Here is a chart that tells you which integer type can store what values.

查看更多
Ridiculous、
5楼-- · 2019-01-14 06:09

You are exceeding the length of int datatype. You can use UNSIGNED attribute to support that value.

SIGNED INT can support till 2147483647 and with UNSIGNED INT allows double than this. After this you still want to save data than use CHAR or VARCHAR with length 10

查看更多
登录 后发表回答