当存储在mysql整数字段中时,允许数字以ZERO开头 [英] Allow number to start with ZERO when stored in mysql integer field

查看:319
本文介绍了当存储在mysql整数字段中时,允许数字以ZERO开头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要存储从0开始的电话号码,但每当我尝试将其存储在MySql表中时,会删除起始的ZERO,因为实际上没有数字以零开头。

I need to store phone numbers starting with 0 but whenever i try to store this in MySql table the starting ZERO is removed because no number start with Zero actually.

如何解决这个问题?我是否需要将字段类型从Integer更改为其他类型?

How to solve this issue? Do I need to change the field type from Integer to another type?

推荐答案

将数据类型更改为 unsigned-zerofill 无论你使用什么,浮点数,整数,小数(6,2)...只编辑字段 unsigned-zerofill

change data type to unsigned-zerofill whatever you are using, float, int, decimal(6,2)... only edit the field to unsigned-zerofill

这篇关于当存储在mysql整数字段中时,允许数字以ZERO开头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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