1292:错误的日期时间值:第1列的'' [英] 1292: Incorrect datetime value: '' for column at row 1
问题描述
我试图将数据从excel工作表加载到Windows 8.1上的MYSQL 5.6的下表中,并且出现日期时间值错误:"错误.
I am trying to load data from excel sheet to the below table on MYSQL 5.6 on windows 8.1 and I am getting 'Incorrect datetime value:' error.
期限日期列为DATETIME数据类型,并且该数据在我要插入表中的Excel工作表中为空值.
Term date column is of DATETIME data type and the data has null values in the excel sheet which I am trying to insert into the table.
我做了一些研究,发现问题出在SQL严格模式下.但是我无法弄清楚如何禁用或修改SQL严格模式.
I did some research and found that the problem is with the SQL strict mode. But I am not able to figure out how to disable or modify the SQL strict mode.
我实际上尝试了这个SET SESSION sql_mode='ALLOW_INVALID_DATES'
,但是没有运气.
I in fact tried this SET SESSION sql_mode='ALLOW_INVALID_DATES'
but no luck.
有人说在安装目录中编辑my.ini文件会有所帮助,但我无法在安装目录中找到它.
Some said editing my.ini file in installation directory will help but I am not able to find it in the installation directory.
任何人都可以帮助我解决此问题.
can any one please help me resolve this issue.
create table EMPLOYEE(EMP_ID integer(10),
EMP_NAME char(25),
SALARY integer(25),
START_DATE datetime,
TERM_DATE datetime DEFAULT '1900-01-01',
PRIMARY KEY (EMP_ID));
错误消息:
15:23:08 INSERT INTO `mith`.`EMPLOYEE` (`EMP_ID`, `EMP_NAME`, `SALARY`, `START_DATE`, `TERM_DATE`) VALUES ('26', 'Will Banker', '90000', '00:00.0', '') 1292: Incorrect datetime value: '' for column 'TERM_DATE' at row 1
推荐答案
我设法使用以下命令解决了类似的问题:
I managed to solve a similar problem using the commands:
mysql> set session sql_mode='';
和
mysql> set global sql_mode='';
在mysql提示符下.
in mysql prompt.
这篇关于1292:错误的日期时间值:第1列的''的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!