某些版本数据库(5.0.41-community-nt)插入 date 类型的字段数据是 "" 空时,会报
Incorrect date value: '' for column 'Birthday' at row 1
类似这样的错误,只要先运行一下
SET SESSION sql_mode=NO_ZERO_IN_DATE;
就可以了
Strict mode still permits zero dates though. To prohibit these, you can use the NO_ZERO_DATE (the entire date cannot be zero) or NO_ZERO_IN_DATE (no part of the date can be zero) modes. A convenient mode to use in this case is TRADITIONAL, which is equivalent to all of the STRICT_TRANS_TABLES, STRICT_ALL_TABLES, NO_ZERO_IN_DATE, NO_ZERO_DATE, ERROR_FOR_DIVISION_BY_ZERO and NO_AUTO_CREATE_USER modes.