Re: '0000-00-00' is an invalid date
From: Peter H. Coffin <hellsop_at_ninehells.com>
Date: Sun, 4 Feb 2018 09:52:21 -0600
Message-ID: <slrnp7eb1l.d0s.hellsop_at_nibelheim.ninehells.com>
Date: Sun, 4 Feb 2018 09:52:21 -0600
Message-ID: <slrnp7eb1l.d0s.hellsop_at_nibelheim.ninehells.com>
[Quoted] On Sun, 4 Feb 2018 07:55:36 -0500, bill wrote:
> I can SELECT * FROM `episodes` where `ending` = '0000-00-00'
> without error, but
> update`episodes` set `ending` = NULL
> where `ending` = '0000-00-00'
> gives me the error.
[Quoted] Two routes:
- Turn zero dates on in your SQL Mode then turn them back off again when you've fixed this. (If you want them off -- leaving them on will PROBABLY get you the behavior you were expecting in the beginning. But it's your database, so you're the one that has to live with any unexpected consequences of a permanent mode change now.)
- cast `ending` as CHAR in your WHERE clause then see if the result is NULL. It won't be '0000-00-00', because that's the problem you have.
It's worth a read through the SQL Modes section of the manual, just to know what kind of things are in there.
-- The pluses in my current job include laughing in the face of Nobel laureates who have just lost the only copy of their data. (Hey, I'm still a BOFH). -- Bob DowlingReceived on Sun Feb 04 2018 - 16:52:21 CET