Categories: ExcelMySQL

mysql 1366错误的解决方案!

提示mysql 1366错误 General error: 1366 Incorrect integer value:

取消mysql字段UNSIGNED的设置,才可以插入0的!

CDbCommand 无法执行 SQL 语句: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: ‘分类’ for column ‘buy_cat_id’ at row 1. The SQL statement executed was: INSERT INTO `erp_customer` (`realname`, `tel`, `address`, `spec_con`, `join_time`, `buy_cat_id`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5)。

在导入excel的时候,出现如果excel中为空值,我将其设为””,仍然会转换为0值的,插入失败,原因便在于mysql中设置了UNSIGNED,导致0值无法插入的情况的!取消字段的设置,便是可以的了!

永夜