views:

42

answers:

1

I haver zero experience with triggers in MySQL. Learnt them in school (Oracle environment).

I have a table which already has a datestamp column for insert date.

I want to update a Record_Touched field whenever any record is touched in this table. What is the best efficient way of doing it?

Thank you...

+2  A: 

Create that field as a TimeStamp and set ON UPDATE CURRENT_TIMESTAMP

As described, I do not believe that you need a Trigger.

Gary
+1: Use the DEFAULT constraint for the desired behavior: http://dev.mysql.com/doc/refman/5.0/en/timestamp.html
OMG Ponies
I already have another column with on update current_timestamp.I want another field and MySQL allows only one such update I believe. Thanks ...
ThinkCode
@ThinkCode: There's no limit to the number of columns with DEFAULT constraints.
OMG Ponies