[thelist] mysql update setting a value to null

Jay Blanchard jay.blanchard at niicommunications.com
Thu Apr 18 07:31:01 CDT 2002


[snip]
and i want the enddate to be null if possible. this is fine.

so i have a record where endate IS NULL. however, if the enddate is then
set to a value, how do i UPDATE the record so that i can return the
value back to NULL?

i've tried 'UPDATE EVENT SET enddate = NULL'
           'UPDATE EVENT SET enddate = 'NULL''
           'UPDATE EVENT SET enddate IS NULL'
[/snip]
I was able to the following in MySQL

UPDATE EVENT
SET enddate = NULL

 and

UPDATE EVENT
SET enddate = (NULL)

I also have a variation in one of my books that shows ANSI-SQL 92 with this
syntax

UPDATE EVENT
SET enddate NULL

but this does not appear to work in MySQL (it throws syntax errors.

HTH!

Jay





More information about the thelist mailing list