"bruce" <[EMAIL PROTECTED]> wrote on 05/08/2004 06:12:58:

> hi...
> 
> a simple question...
> 
> i'm creating a table and want to set a column to have the default of the
> current day/time when the row is created...
> 
> i've tried...
> 
> create table foo(
> dog int,
> timestamp1 default NOW()
> );

Defaults can *only* be constants, which NOW() isn't.

However, a TIMESTAMP column can be set to default to the current time on 
row creation. The behaviour differs slightly between pre-4.1 and 4.1. See 
http://dev.mysql.com/doc/mysql/en/TIMESTAMP_pre-4.1.html and 
http://dev.mysql.com/doc/mysql/en/TIMESTAMP_4.1.html .

        Alec



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

Reply via email to