List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:August 24 2001 1:37am
Subject:Re: Create Table Syntax for DEFAULT
View as plain text  
At 5:18 PM -0700 8/23/01, Igbar Foosenhopper wrote:
>Is it possible to use current_date (mysql function) to generate a
>default for a column?

No.  Defaults must be constants.

>If so .. what would the syntax look like.  I have tried several things
>and it doesn't seem to like it.
>If not .. how could I generate a default of todays date (of course
>dependent on the date of insert)?

Use a TIMESTAMP, which gets the current date and time automatically
if you set it to NULL or leave it out of the INSERT statement altogether.
Alternative, use a DATETIME and set it to NOW() when you insert a

>Best regards,
>  Igbar                          mailto:IgbarFoosenhopper@stripped

Paul DuBois, paul@stripped
Create Table Syntax for DEFAULTIgbar Foosenhopper24 Aug
  • Re: Create Table Syntax for DEFAULTPaul DuBois24 Aug