2013-08-23 9 views
5

イベントを作成しました。それは私が作成した時間に実行されています。しかし、私はいつでもmysqlサーバが起動したときにイベントを実行したい。私は2013年8月23日10時42分53秒で起動すると、それが表示されているショーのイベントを入力し、私はすべての上でそれを実行したい場合は、私はCL_PL_CREDITコードと呼ばれるイベントを作成した例については は起動時のイベントスケジューリング

delimiter | 

CREATE EVENT RURALSHORES2.UpLv 
    ON SCHEDULE 
     EVERY 1 MONTH 
    DO 
     BEGIN 
     update emp_lv_rem set cl_count=cl_count+1,pl_count=pl_count+1.25 where emp_id in (select emp_id from emp_main where EmploymentType="Permanent" or EmploymentType="Regular"); 
     update emp_lv_rem set cl_count=1,pl_count=1 where emp_id in (select emp_id from emp_main where EmploymentType="Probation"); 
     update emp_lv_rem set cl_count=1,pl_count=0 where emp_id in (select emp_id from emp_main where EmploymentType="Contract" or EmploymentType="Partime" or EmploymentType="Trainee" or EmploymentType="Consultant"); 
update emp_lv_rem set cl_count=0,pl_count=0 where emp_id in (select emp_id from emp_main where EmploymentType="Contract" and EmploymentType<>"Partime" and EmploymentType<>"Trainee" and EmploymentType<>"Consultant" and EmploymentType="Permanent" and EmploymentType="Regular" and EmploymentType="Probation"); 

    END |; 

delimiter ; 

、のように見えますいつでもサーバーが始まる月の初日。

+0

サーバーが毎月1日を再起動することを、あなたはいつでもサーバーイベントを実行することを意味しますか再起動するか、毎月1日ごとにイベントを実行したいのですか? – RenkyaZ

答えて

1

あなたは開始日を追加する必要があり、それを毎月1日を実行するために:

ON SCHEDULE 
    EVERY 1 MONTH 
    STARTS AT '2013-09-01 00:00:00' 
関連する問題