On Wed, May 26, 2004 at 06:20:22PM -0700, Scott Haneda wrote:
> I have a field in mysql 4, using InnoDB
> Field is timestamp 14 and defualt is set to 00000000000000, which I want to
> be the result of NOW() so that every record made will get NOW() as the
> value, I can not get it to work...
> 
> ALTER TABLE `addresses` CHANGE `added` `added` TIMESTAMP( 14 ) DEFAULT
> 'NOW()';
> Query OK, 2 rows affected (0.01 sec)
> Records: 2  Duplicates: 0  Warnings: 0
> 
> It tells me it worked, but then it reverts back to the zero's.

If you do a SHOW CREATE TABLE on the table, you'll see that it has
actually ignored your DEFAULT. (What is has done is actually transformed
it to '00000000000000', since that is what the string 'NOW()' becomes
when you convert it to a TIMESTAMP.)

Read this section in the manual for information on how the default value
for TIMESTAMP columns is handled:

  http://dev.mysql.com/doc/mysql/en/TIMESTAMP_pre-4.1.html

Support for specifying how TIMESTAMP columns get updated is coming in
4.1.2. Right now, it is only documented in the change notes:

  http://dev.mysql.com/doc/mysql/en/News-4.1.2.html

Jim Winstead
MySQL AB

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

Reply via email to