According to the manual, 'timestamp' does exactly what you are asking
for:

"The TIMESTAMP column type provides a type that you can use to
automatically mark INSERT or UPDATE operations with the current date and
time. If you have multiple TIMESTAMP columns, only the first one is
updated automatically.

Automatic updating of the first TIMESTAMP column occurs under any of the
following conditions:

    * The column is not specified explicitly in an INSERT or LOAD DATA
INFILE statement.
    * The column is not specified explicitly in an UPDATE statement and
some other column changes value. (Note that an UPDATE that sets a column
to the value it already has will not cause the TIMESTAMP column to be
updated, because if you set a column to its current value, MySQL ignores
the update for efficiency.)
    * You explicitly set the TIMESTAMP column to NULL. "

(from http://www.mysql.com/doc/en/DATETIME.html)

Or am I missing something ?

Regards,
Joseph Bueno

[EMAIL PROTECTED] wrote:
> I've created a table that contains a column called
> "recordLastModified" and that column uses "timestamp"
> as the data type.  Is there a way in MySQL to
> automatically update timestamp fields as records are
> modified?  I want it to be nearly automatic in the
> same way that using "auto_increment" increases int
> data types, since that is faster than remembering to
> type numbers each time you add a new record. If not,
> how can I structure my insert or
> update statements to automatically capture the
> server's sytem time into the timestamp field, or am I
> required to manually include the date/time when I
> update a record?
> 
> Thanks.
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
> 


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to