mysql - update timestamp trigger not working -
mysql - update timestamp trigger not working -
iam trying create trigger on particular field of table.each time value of column changes timestamp should recorded in timestamp column field ticket_close_time (data tytpe timestamp).but every time seek execute trigger error "#1064 - have error in sql syntax; check manual corresponds mysql server version right syntax utilize near '' @ line 6" dont understand issue is.i have tried now(),current_timestamp nil works maintain getting error.
trigger code
delimiter // create trigger updtrigger before update on ticket_tran each row begin if new.ticket_resolved_flag <> old.ticket_resolved_flag set new.ticket_close_time = now(); end if; end //
there no need trigger, mysql has native on update current_timestamp
see: http://dev.mysql.com/doc/refman/5.0/en/timestamp-initialization.html
as trigger: can't spot syntax error. think problem delimiter still set ; create sure have set delimiter other ; before executing create trigger statement. can executing command:
delimiter //
mysql triggers
Comments
Post a Comment