mysql 5.6 每天凌晨12:00 重置sequence表中的某个值

#1、创建evevt要调用的存储过程update_current_value_procedure
delimiter //
drop procedure if exists update_current_value_procedure//
create procedure update_current_value_procedure()
begin
    update  xw_sequence  set CURRENT_VALUE=1 where SEQ_NAME=  'group_id_seq';
end//
delimiter ;

#2、创建事件update_current_value_event

drop event if exists update_current_value_event;
create event update_current_value_event
ON SCHEDULE EVERY 1 DAY STARTS '2017-05-08 00:00:00'
on completion preserve disable
do call update_current_value_procedure();


#3、开启事件update_current_value_event
alter event update_current_value_event on completion preserve enable;

 

posted @ 2017-05-08 19:49  Alamps  阅读(1014)  评论(3编辑  收藏  举报