Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
aclagarde
Starting Member
3 Posts |
Posted - 2013-09-23 : 14:25:11
|
I am trying to create a daily event that creates a table with a member count in it so I have a snapshot of membership every morning. The SQL statement in there works by itself but for some reason I can't get it to work when I put it in the event creation command I get errors...-- SET GLOBAL event_scheduler = ON$$ -- required for event to execute but not create CREATE /*[DEFINER = { user | CURRENT_USER }]*/ EVENT `ezvue`.`Member_Count_Daily`ON SCHEDULE /* uncomment the example below you want to use */ -- scheduleexample 1: run once -- AT 'YYYY-MM-DD HH:MM.SS'/CURRENT_TIMESTAMP { + INTERVAL 1 [HOUR|MONTH|WEEK|DAY|MINUTE|...] } -- scheduleexample 2: run at intervals forever after creation EVERY 1 MINUTE STARTS '2013-09-20 03:00:00' -- scheduleexample 3: specified start time, end time and interval for execution /*EVERY 1 [HOUR|MONTH|WEEK|DAY|MINUTE|...] STARTS CURRENT_TIMESTAMP/'YYYY-MM-DD HH:MM.SS' { + INTERVAL 1[HOUR|MONTH|WEEK|DAY|MINUTE|...] } ENDS CURRENT_TIMESTAMP/'YYYY-MM-DD HH:MM.SS' { + INTERVAL 1 [HOUR|MONTH|WEEK|DAY|MINUTE|...] } *//*[ON COMPLETION [NOT] PRESERVE][ENABLE | DISABLE][COMMENT 'comment']*/DO BEGINDROP TABLE `ezvue`.`Member_Count`$$ CREATE TABLE Member_Count ( Member_Count VARCHAR(100))$$ INSERT INTO member_count (Member_Count) SELECT COUNT(membid) FROM memb_info WHERE STATUS = 'a'$$ END$$DELIMITER ;Abe |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-09-23 : 14:29:06
|
Is this T-SQL? Are you using SQL Server?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
aclagarde
Starting Member
3 Posts |
Posted - 2013-09-23 : 14:33:32
|
I believe I am using SQL server for this one...Abe |
|
|
aclagarde
Starting Member
3 Posts |
Posted - 2013-09-23 : 15:03:41
|
Actually, yes, the sql software I am running DOES support transact-sql...Abe |
|
|
|
|
|