当列为INT(10)时为什么不能插入10位数字 [英] Why can't I insert 10 digits when my column is INT(10)

查看:154
本文介绍了当列为INT(10)时为什么不能插入10位数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个专栏 INT(10) ZEROFILL NOT NULL DEFAULT '0000000000',

但是当我插入类似9100000010的内容时,我会得到4294967295

But when I insert something like 9100000010, I get 4294967295

应该在那允许10位数字,对吧?

It should have allowed 10 digits there, right?

如何正确执行此操作?

推荐答案

Int具有最大值范围:

Int has maximum value range :

INT 4   -2147483648 2147483647
        0   4294967295 (unsigned )

因此,由于溢出,您将获得最大值. 使用bigint代替,它有8个字节 你会没事的.

hence, you are getting the maximum value due to the overflow. use bigint instead, which has 8 bytes and you shall be fine.

http://dev.mysql. com/doc/refman/5.0/en/numeric-types.html#integer-types

BIGINT  8   -9223372036854775808    9223372036854775807
          0                 18446744073709551615

这篇关于当列为INT(10)时为什么不能插入10位数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆