On Tue, 4 Mar 2008, Jay Blanchard <[EMAIL PROTECTED]> wrote:
It was much too quick a reply on my part but it is my understanding that a TIMESTAMP field is updated according to server time and you cannot actually insert a value. I may be wrong as I have never tested this.
Even in pre-4.1 versions, per <http://dev.mysql.com/doc/refman/4.1/en/timestamp-pre-4-1.html>, You can set any TIMESTAMP column to a value different from the current date and time by setting it explicitly to the desired value. This is true even for the first TIMESTAMP column. though in those versions it took some work to keep it from updating automatically. Those limitations have apparently been lifted starting from 4.1. Experimentally, $ mysql ... Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 122433 to server version: 4.1.7-standard Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> create table u (f timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP); Query OK, 0 rows affected (0.00 sec) mysql> insert into u values ('2007-02-03 7:08:09'); Query OK, 1 row affected (0.00 sec) mysql> select * from u; +---------------------+ | f | +---------------------+ | 2007-02-03 07:08:46 | +---------------------+ 1 row in set (0.00 sec) TIMESTAMP columns *can* be used to "update according to server time", as explained at <http://dev.mysql.com/doc/refman/4.1/en/timestamp.html>, and as shown above with default CURRENT_TIMESTAMP -- but that does it when you set it to NULL via INSERT or UPDATE on update CURRENT_TIMESTAMP -- but that does it when you update some other column without setting this TIMESTAMP column or, of course, setting it to NOW() or one of its synonyms. -- Tim McDaniel, [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]