List:MySQL on Win32« Previous MessageNext Message »
From:Paul DuBois Date:May 14 2002 3:22am
Subject:Re: DEFAULT HOUR(NOW()) ?
View as plain text  
At 13:10 -0400 5/9/02, Joachim Schmidt wrote:
>Hi, I am trying to create a table with one column having by default the
>actual hour of the day.
>the code looks like
>create table test (clock TIME, DEFAULT HOUR(NOW()));
>I get an SQL error. Is there a way to define a default like that in mysql?
>I would be grateful if some one can give me a suggestions in this regard

According to the MySQL manual, default values must be constants.

Set the column to the current hour at the time you create the record.
DEFAULT HOUR(NOW()) ?Joachim Schmidt9 May
  • Re: DEFAULT HOUR(NOW()) ?Paul DuBois14 May