From: Martijn Tonies Date: May 15 2009 1:43pm Subject: Re: Inserting a default null date List-Archive: http://lists.mysql.com/mysql/217564 Message-Id: <02a101c9d563$16b59f90$1401a8c0@martijnws> MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit Hi, > I have a table with a column like: > > date date default null, > > If I enter an empty string in it, the default null value is added (as it > should). > > But if I enter an invalid date by mistake, the date 0000-00-00 date date > is entered instead of the default null, and this is not good. > > Can I do something to force MySQL to insert a null date if the entered > date is an invalid one? That's silly, if the data you want to insert is considered to be invalid, reject it, don't replace it with NULL. With regards, Martijn Tonies Upscene Productions http://www.upscene.com Download FREE! Database Workbench Lite for MySQL! Database questions? Check the forum: http://www.databasedevelopmentforum.com