Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL error code 1292 incorrect date value 1999 for column at row 1

Tags:

mysql

This question has been addressed before many times, but the answers are about the wrong format of the date. The format of the date I have used is correct: YYYY-MM-DD according to the manual.

So what could be the possible cause of this error?

I am using MySQL 5.5 if that matters.

EDIT:- The query I am trying to execute:-

insert into table2 (pk_id)
select pk_id from table1
where pk_date in  (2014-01-04, 2014-02-05, 2014-03-23, 2014-05-01, 2014-07-28) 
order by pk_id asc;
like image 429
Solace Avatar asked Oct 21 '25 05:10

Solace


1 Answers

The issue is on the IN condition for dates, date is string and it needs to be quoted with single quote as

where pk_date in ('2014-01-04', '2014-02-05', '2014-03-23', '2014-05-01', '2014-07-28')
like image 199
Abhik Chakraborty Avatar answered Oct 23 '25 21:10

Abhik Chakraborty



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!