List:General Discussion« Previous MessageNext Message »
From:Joshua Chamas Date:September 16 1999 5:53pm
Subject:Re: SET DEFAULT to current date (that row is created)
View as plain text  
"darcy w. christ" wrote:
> is there a way to set the default for a column to be the current date,
> without making that column a timestamp? i'm trying to provide the
> current date as the starting point for a column that will ultimately be
> changed. it seems that if mysql would accept multiple select statements,
> i should be able to do it with the following syntax:
>     ALTER table paintings ALTER column creation_date SET DEFAULT (select
> current_date());
> any suggestions?

I had the same problem, when porting from an Oracle, which does
support DEFAULT sysdate() its table declarations.

The MySQL dev team told me that this is a feature slated for 
MySQL 4.0, which will store the entire table as originally 
declared so things like default functions() will be possible.
It sounds like there is no where to store that data currently.

My solution, uugghh, was to just put a sysdate() into the creation_date
field for all my relevant insert statements.

-- Joshua
Joshua Chamas                      Chamas Enterprises Inc.
NODEWORKS - web link monitoring    Long Beach, CA  USA  1-562-432-2469 
SET DEFAULT to current date (that row is created)darcy w. christ16 Sep
  • Re: SET DEFAULT to current date (that row is created)Joshua Chamas16 Sep