MySQL Forums
Forum List  »  InnoDB

Self-updating timestamp?
Posted by: Ted Roche
Date: January 18, 2005 04:44PM

I've read the documentation on Timestamp properties as of MySQL 4.1,

http://dev.mysql.com/doc/mysql/en/TIMESTAMP_4.1.html

and alter table,

http://dev.mysql.com/doc/mysql/en/ALTER_TABLE.html

but the exact syntax to create or modify a timestamp field so that it automatically is updated on insert and update eludes me. I've tried:

ALTER TABLE user MODIFY tChanged TIMESTAMP(10) NOT NULL DEFAULT NOW();

but that only sets the field to be filled in on INSERT, not to be updated on UPDATE. The top URL above refers to an ON UPDATE syntax that would do this, but the exact statement has eluded me. Any suggestions?

Ted Roche, MCSE, MCSD
Ted Roche & Associates, LLC
http://www.tedroche.com

Options: ReplyQuote


Subject
Views
Written By
Posted
Self-updating timestamp?
8380
January 18, 2005 04:44PM
3794
January 19, 2005 08:51AM
3616
January 19, 2005 02:47PM
3391
January 20, 2005 01:37PM
3612
January 20, 2005 02:52PM
3605
January 20, 2005 07:46PM
3311
January 21, 2005 08:15AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.