MySQL IFNULL and date comparison glitch?

232 views Asked by At

I have od_bulk table my InDate column defined as DATE.

Running the following query

SELECT IFNULL(InDate, CURDATE()) ReturnDate FROM od_bulk

generates the following error message

Type of value has a mismatch with column typeCouldn't store <2/27/2012 12:00:00 AM> in IFNULL(InDate, CURDATE()) Column. Expected type is MySqlDateTime.

Using CAST is the only way to get it executed

SELECT CAST(IFNULL(InDate, CURDATE()) AS DATE) ReturnDate FROM od_bulk

Is this an expected behavior?

Update: Thanks for all the tips. This seems to be a glitch in DevArt's myDAC connector. I tested the table/code using phpMyAdmin and it works as expected without any casting

0

There are 0 answers