# [EMAIL PROTECTED] / 2003-06-25 12:05:49 +0800:
>       //Wrong sql statement
>       alter table p_asset add mydate datetime default now();
>     alter table p_asset add mydate datetime default time();
>       alter table p_asset add mydate datetime default now;
>     alter table p_asset add mydate datetime default time;
>       alter table p_asset add mydate datetime default date();
>     alter table p_asset add mydate datetime default datetime();
> 
> 
>     How can I add the default now value into the specified column?
>     I try to find in the mysql manual,but in the default value
>     charter,no relative information can be found.

    There *is* relevant information in the manual:

    http://www.mysql.com/doc/en/CREATE_TABLE.html:

    A DEFAULT value has to be a constant, it cannot be a function or an
    expression.

    http://www.mysql.com/doc/en/DATETIME.html:

    The TIMESTAMP column type provides a type that you can use to
    automatically mark INSERT or UPDATE operations with the current date
    and time. If you have multiple TIMESTAMP columns, only the first one
    is updated automatically.

    Automatic updating of the first TIMESTAMP column occurs under any of
    the following conditions:

        * The column is not specified explicitly in an INSERT or LOAD
          DATA INFILE statement.
        * The column is not specified explicitly in an UPDATE statement
          and some other column changes value. (Note that an UPDATE that
          sets a column to the value it already has will not cause the
          TIMESTAMP column to be updated, because if you set a column to
          its current value, MySQL ignores the update for efficiency.)
        * You explicitly set the TIMESTAMP column to NULL. 

-- 
If you cc me or remove the list(s) completely I'll most likely ignore
your message.    see http://www.eyrie.org./~eagle/faqs/questions.html

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to