vps
vps

Reputation: 1367

Error in MySQL Event: "execution time is in the past and ON COMPLETION NOT PRESERVE is set"

I am writing an event in MySQL. I want to execute the event in 1st day of the current month.

My code:

CREATE EVENT EVT_UP_COMPOFF 
ON
SCHEDULE AT CAST(DATE_FORMAT(NOW(),'%Y-%m-01')as DATE)
DO
  UPDATE tbl_compoff_leave_count set fld_status='Invalid'
  WHERE MONTH(fld_compoff_date)< MONTH(DATE_ADD(CURDATE(), INTERVAL -1 MONTH))
    AND fld_status='Valid';

Error:

1588: Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation

What do I need to fix in the SQL?

Upvotes: 0

Views: 638

Answers (1)

Devart
Devart

Reputation: 121922

Try this event -

CREATE EVENT event1
  ON SCHEDULE EVERY '1' MONTH
  STARTS '2012-09-01 00:00:00'
DO UPDATE...

Upvotes: 2

Related Questions