You're right, just tested it myself on 3.23.41; and I get exactly
the same result as you. We should post an amendment to the docs
on the website.

However, (still with 3.23.41):

mysql> create table autotime2 (foo int, bar timestamp default now());
ERROR 1064: You have an error in your SQL syntax near 'now())' at line 1
mysql> create table autotime2 (foo int, bar timestamp default 'now()');
Query OK, 0 rows affected (0.00 sec)

mysql> insert autotime2 set foo = 2;
Query OK, 1 row affected (0.00 sec)

mysql> insert autotime2 set foo = 1;
Query OK, 1 row affected (0.00 sec)

mysql> select * from autotime2;
+------+----------------+
| foo  | bar            |
+------+----------------+
|    2 | 20030625102215 |
|    1 | 20030625102222 |
+------+----------------+
2 rows in set (0.00 sec)

Cheers,
Jan  



Sometime recently Roman Neuhauser said:
> # [EMAIL PROTECTED] / 2003-06-25 06:18:04 +0100:
> > Sometime recently MaFai said:
> > >   A table contains a column named "mydate".
> > >   
> > >   //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.
> > >     
> > >    I also know this question is stupid,but hope you help.
> > 
> > alter table p_asset add mydate datetime default 'now()';
> > 
> >  - you need the '' around now(); apparently
> > 
> > http://www.mysql.com/doc/en/DATETIME.html
> > and scroll down to the comment made by 
> > Lazy Soul on Tuesday May 27 2003, @8:15am
> 
>     I'd like to know in which version of MySQL this does what it's
>     intended to do. Definitely not in 4.0.13:
> 
>     mysql> create table autotime (foo int, bar datetime default 'now()');
>     Query OK, 0 rows affected (0.00 sec)
> 
>     mysql> insert autotime set foo = 1;
>     Query OK, 1 row affected (0.06 sec)
> 
>     mysql> insert autotime set foo = 2;
>     Query OK, 1 row affected (0.00 sec)
> 
>     mysql> select * from autotime;
>     +------+---------------------+
>     | foo  | bar                 |
>     +------+---------------------+
>     |    1 | 0000-00-00 00:00:00 |
>     |    2 | 0000-00-00 00:00:00 |
>     +------+---------------------+
>     2 rows in set (0.02 sec)
> 
>     mysql> select version();
>     +------------+
>     | version()  |
>     +------------+
>     | 4.0.13-log |
>     +------------+
>     1 row in set (0.00 sec)
> 
> 
> -- 
> 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
> 

-- 
Janice Wright
Ingenta plc
[EMAIL PROTECTED]
Tel: +44 (0) 01865 799114 
http://www.ingentaselect.com/

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

Reply via email to