Mysql import transforms timestamp null values to 0000-00-00 00:00:00

一曲冷凌霜 提交于 2019-12-06 06:07:33

If table definition allows null and defaults to NULL and your source data also contains \N then you should get NULL as expected. MySQL is not a reliable database server in many different ways, so I'd need your sources (at least some sample) to diagnostic the actual problem. May be empty string instead of \N.

There can be quick hack:

  • For the time being change that datetime column's type to VARCHAR so that null values become empty strings.

  • When import is complete change that column's type back to datetime and it'll give you the desired results :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!