13

I want my event to run everyday at 00:20. I am confused in scheduling of the time. Should I be using the first option or the second one?

Option 1

CREATE EVENT my_event
  ON SCHEDULE
    EVERY 1 DAY
    STARTS '2014-04-30 00:20:00' ON COMPLETION PRESERVE ENABLE 
  DO
    # My query

Option 2

CREATE EVENT my_event
  ON SCHEDULE
    AT ('2014-04-30 00:20:00'+ INTERVAL 1 DAY) ON COMPLETION PRESERVE ENABLE 
  DO
    # My query
11

Use the first one if you want to execute your event everyday.

The second syntax will execute once.

Option 1: Execute the event every night at 00:20

Option 2: Execute the event once the 2014-05-01 at 00:20

Max.

2
  • 1
    Just wondering: what does ON COMPLETION PRESERVE ENABLE mean? Jul 11 '16 at 19:18
  • 1
    @KolobCanyon ON COMPLETION PRESERVE to make it a repeatable event so you don't have to create it again. Oct 18 '16 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.