Jochem van Dieten wrote: > Keith Gaughan wrote: >> >> As I said, I'm not defending MySQL. I'm saying that the behaviour of >> NULLs in SQL is, well, buggered. Attacking a DBMS, any DBMS on the way >> it handles them in various situations is a bit like shooting fish that >> are fastened to the barrel of your gun. >> >> The thing is, the overloading of NULL in various DBMSs probably made >> sense at the time. Just to taking the situation with MySQL, there are >> times where you're inserting a new record and you may or may not want >> the default value, but you'll only know at run time. >> >> A better solution would be to have a "USE_DEFAULT" keyword for that >> particular kind of null value or something like that, but extending the >> DML like that can be argued against easily too. > > Did you know that SQL has a DEFAULT keyword exactly for that > purpose? The problem is MySQLs implementation of DEFAULT, not the > standard.
On re-reading that was very poorly worded by me. The SQL DEFAULT keyword is not just meant for use in DDL. SQL is defined in such a way that you can also use DEFAULT in DML to (re)set any column to its default value. You don't even have to know what that default is. So in SQL you can use the command "UPDATE subscribers SET title = DEFAULT" to restore the default value for the title field in the subscribers table. More complete implementations already have your better solution. Jochem ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208276 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54