MySQL Forums
Forum List  »  Events (Job Scheduler)

I need to run this vent
Posted by: Gertrudis Jimenez
Date: May 14, 2016 08:56PM

Hi to All

Thank in advance

Can Execute this sql statement:

set @max_pk= (SELECT concat(month(NOW())+1,RIGHT(year(now()),2),"0000"));
SET @s = CONCAT("alter table auto_inc auto_increment=",@max_pk);
PREPARE stmt FROM @s;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;


but if I want to create an event i got an error, the sql is:

CREATE EVENT event1
ON SCHEDULE EVERY '1'
MONTH STARTS '2011-05-24 00:00:00'
DO
@max_pk=0;
set @max_pk= (SELECT concat(month(NOW())+1,RIGHT(year(now()),2),"0000") FROM DUAL);
SET @s = CONCAT("alter table auto_inc auto_increment=",@max_pk);
PREPARE stmt FROM @s;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;


please help:

Options: ReplyQuote


Subject
Views
Written By
Posted
I need to run this vent
1162
May 14, 2016 08:56PM
569
May 15, 2016 10:49AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.