Sample Header Ad - 728x90

MySQL schedular every day in a time periode every hour

0 votes
1 answer
3342 views
This schedular i made doesn't work how i would like it to work. The idea is that it will run every day in a time periode from 06:15:00 till 23:59:59 and in that only periode run every hour That means it will run on 06:15 - 07:15 - 08:15 etc.. till 23:15 and start over again the next day Server version: innodb_version:5.7.25 DELIMITER | /* 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 */ ALTER EVENT Database.Import_data01_view ON SCHEDULE EVERY 1 HOUR STARTS '2019-04-15 06:15:00' ON COMPLETION PRESERVE ENABLE DO BEGIN /* do things */ END | DELIMITER ; With the info i found my own solution for it: DELIMITER | /* 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 */ ALTER EVENT Database.Import_data01_view ON SCHEDULE EVERY 1 HOUR STARTS str_to_date( date_format(now(), '%Y%m%d 0615'), '%Y%m%d %H%i' ) ON COMPLETION PRESERVE ENABLE DO BEGIN IF time(CURRENT_TIMESTAMP) between time('06:14:59') and time('23:59:59') THEN /* doe something */ end if; END | DELIMITER ;
Asked by F T (11 rep)
Apr 15, 2019, 07:05 AM
Last activity: Oct 9, 2021, 08:05 PM