Home >Database >Mysql Tutorial >关于mysql插入int空值的处理_MySQL

关于mysql插入int空值的处理_MySQL

WBOY
WBOYOriginal
2016-06-01 13:35:351391browse

bitsCN.com

最好的也是用的最多的方法是:

将int型空值不允许为空 默认为0.这样就不会出现因为允许为空 插入空值变为0的情况。虽然用起来要判断一下,但却不会出现问题。

其它的方法,来自网络,咱未验证

如果已经安装好了的,就在my.ini中查找sql-mode,默认为sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION",将其修改为sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION",重启mysql后即可。

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn