List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:September 11 2000 9:34pm
Subject:RE: DEFAULT on DATETIME fields
View as plain text  
At 4:10 PM -0500 09-11-2000, Will Stranathan wrote:
>That's what I originally thought - that I was setting it to a constant, but
>I've seen other messages to the mailing list suggesting the user use that
>syntax.
>
>Thanks for the help.

Those were probably written by people who thought that would work, but
never tested it to see whether or not it really would. :-)


>
>w
>
>-----Original Message-----
>From: Paul DuBois [mailto:paul@stripped]
>Sent: Monday, September 11, 2000 4:11 PM
>To: Will Stranathan; 'mysql@stripped'
>Subject: Re: DEFAULT on DATETIME fields
>
>
>At 3:51 PM -0500 09-11-2000, Will Stranathan wrote:
>>I want a DATETIME field that, when a row is created, is auto-populated to
>>the current timestamp, however, I DON'T want the field updated when the
>>record is modified, AND I want to allow NULL values on the field.  However:
>>
>>CREATE TABLE FOO (
>>	ID INT AUTO_INCREMENT NOT NULL PRIMARY KEY,
>>	THISDATE DATETIME NULL DEFAULT 'CURRENT_TIMESTAMP'
>>);
>
>Your statement specifies a default value consisting of the string
>'CURRENT_TIMESTAMP'.  Not what you want.
>
>>I want the THISDATE field to have the date and time that the record was
>>entered.  Is there a way to do this without a TIMESTAMP?  (Since I don't
>>want the field updated every time, and I want to be able to explicitly go
>  >back and set the field to NULL).


-- 
Paul DuBois, paul@stripped
Thread
DEFAULT on DATETIME fieldsWill Stranathan11 Sep
  • Re: DEFAULT on DATETIME fieldsPaul DuBois11 Sep
RE: DEFAULT on DATETIME fieldsWill Stranathan11 Sep
  • RE: DEFAULT on DATETIME fieldsPaul DuBois11 Sep
  • Installation help needed.Mysql Mailing List12 Sep