DelphiFAQ Home Search:

My timestamp field in mysql does not update


commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.


To track changes in our database, I added two columns to all my tables named


The timestamp field should get updated every time any other column gets updated. For some tables this works, for some it does not. Why is that?


This behavior sounds like you are using a mysql version prior to 4.1.2. And in those tables where it does not work, you probably have another field of type TIMESTAMP already.


In mysql with versions before 4.1.2 the first TIMESTAMP column in automatically is set to the current timestamp when the record is created if the field value is set to NULL or not not specified at all. During updates the first TIMESTAMP column in table row automatically is updated to the current timestamp when the value of any other column in the row is changed, unless the TIMESTAMP column explicitly is assigned a value other than NULL.


2012-11-12, 03:40:23
coach001 from United Kingdom  



NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: