David N
David N

Reputation: 130

MYSQL 8 : SQL Mode for Datetime invalid?

I know, it's ugly but things used to work and we can't change this :

#1525 - Incorrect DATETIME value: ''

For a query

SELECT * FROM table WHERE date_change=''

Is there a SQL mode for MySQL 8? Or any idea?

Upvotes: 1

Views: 2600

Answers (2)

Mr Heelis
Mr Heelis

Reputation: 2556

SET @@sql_mode := REPLACE(@@sql_mode, 'NO_ZERO_IN_DATE', '');

will do it

Upvotes: 0

Luuk
Luuk

Reputation: 14958

see: https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html#sqlmode_no_zero_in_date

If sql_mode has 'NO_ZERO_IN_DATE' then you cannot have a zero_date (or datetime).

Upvotes: 1

Related Questions