1

I want to create an Event that will run each day at midnight + 1 second, I've check a lot of threads explaining the Event and all yet I don't understand why I have an Syntax error in MySql V.6.2

CREATE EVENT TestEvents
ON SCHEDULE 
    EVERY 1 DAY
    STARTS (TIMESTAMP(CURRENT_DATE) + INTERVAL 1 DAY + INTERVAL 1 SECOND)
DO
    BEGIN
        CALL sp_SchedulerTask_CreateInsertSalesCsvFile();
        CALL sp_SchedulerTask_CreateUpdateSalesCsvFile();
    END;

Thanks for the answers

Sam
  • 85
  • 3
  • 16
  • What's the exact error you're getting? – Mureinik Feb 11 '15 at 19:49
  • Error Code : 1064. you have an error in your SQL syntax; check the manual that correspond to your MySQL server version for the right syntax to use near '' at line 7 – Sam Feb 11 '15 at 19:50
  • The code is perfectly fine and the error message doesn't say anything about a non-existing object/id, so I'm a bit perplex about the error. What MySQL server version do you use? – Mike Lischke Feb 12 '15 at 09:04

1 Answers1

0

Try to define "midnight + 1 second" as a date (e.g. 2019-09-10 00:00:01)

Also, try using a delimiter:

Full example:

DELIMITER //
CREATE EVENT TestEvents
ON SCHEDULE 
    EVERY 1 DAY
    STARTS '2019-09-10 00:00:01'
DO
    BEGIN
        CALL sp_SchedulerTask_CreateInsertSalesCsvFile();
        CALL sp_SchedulerTask_CreateUpdateSalesCsvFile();
END 
//
Leonardo Kuffo
  • 901
  • 9
  • 10