Skip to content
Advertisement

mysql allow invalid dates on select

For some reason, I can’t even select invalid dates in my table. How do I force select? I just receive:

select * from table
>> Mysql2::Error: Invalid date: 1900-00-00

I’m not trying to insert, just select. Can I set allow invalid dates in select query?

mysql --version
mysql  Ver 14.14 Distrib 5.1.61, for debian-linux-gnu (i686) using readline 6.1

mysql> select @@global.sql_mode;
+-------------------+
| @@global.sql_mode |
+-------------------+
|                   |

Advertisement

Answer

This is what I do to ignore invalid dates:

SET SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement