MySQL Forums
Forum List  »  MySQL Workbench

Table datetime updates
Posted by: Pete Watters
Date: January 23, 2018 12:39PM

Using work bench I have a table with columns for date_created and Date_updated the data type is DATETIME

I want the date_created to be set to current_time_stamp when the record is created (insert) and to never change

For date_updated I want it to be set to the current_time_stamp when it is inserted/created and set to the current_time_stamp when ever the recorded is updated

Using the column name for date_created I set the default = current_timestamp
Will this work

for date_updated I left the default blank, do I need to create a triger?

Can some one give me an example of ho to set this up

Thanks

Options: ReplyQuote


Subject
Views
Written By
Posted
Table datetime updates
495
January 23, 2018 12:39PM


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.