Hello.


>But I don't want the value to be updated automatically after an update.



Use DEFAULT CURRENT_TIMESTAMP. You can see that after an update, the

value of the timestamp column didn't changed:



mysql> create table timeup(a int,b timestamp default current_timestamp);

Query OK, 0 rows affected (0,16 sec)



mysql> insert into timeup set a=1;

Query OK, 1 row affected (0,01 sec)



mysql> select * from timeup;

+------+---------------------+

| a    | b                   |

+------+---------------------+

|    1 | 2005-08-17 00:45:42 |

+------+---------------------+

1 row in set (0,00 sec)



mysql> update timeup set a=2;

Query OK, 1 row affected (0,00 sec)

Rows matched: 1  Changed: 1  Warnings: 0



mysql> select * from timeup;

+------+---------------------+

| a    | b                   |

+------+---------------------+

|    2 | 2005-08-17 00:45:42 |

+------+---------------------+



See:

  http://dev.mysql.com/doc/mysql/en/timestamp-4-1.html



" With a DEFAULT CURRENT_TIMESTAMP clause and no ON UPDATE clause, the

column has the current timestamp for its default value but is not

automatically updated."





"Frank Busch" <[EMAIL PROTECTED]> wrote:

Hi,



>I want to save date and time of the creation of a row in a field.

>

>That could be handled by a timestamp, I know that.

>

>But I don't want the value to be updated automatically after an update.

>

>I tried 

>

>.

>

>creation datetime not null default now()

>

>.

>

>in the create table statement, but got an error.

>

> 

>

> I know, that I'm able to use creation=now() in the insert statement,

> but

> parts of the code are encrypted and I can't change them. So I need a

> way to

> handle that without modifying the statements.

>

>  

>

>       Got any ideas?



         



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Gleb Paharenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.NET
       <___/   www.mysql.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