Chapter 9 SQL Statements
435
CREATE EVENT statement
Use this statement to define an event and its associated handler for
automating predefined actions. Also, to define scheduled actions.
CREATE EVENT
event-name
… [ TYPE
event-type
[ WHERE
trigger-condition
[ AND
trigger-condition
], … ]
| SCHEDULE
schedule-spec
, … ]
… [ ENABLE | DISABLE ]
… [ AT { CONSOLIDATED | REMOTE | ALL } ]
…[ HANDLER
BEGIN
…
END ]
event-type
BackupEnd | "Connect"
| ConnectFailed | DatabaseStart
| DBDiskSpace | "Disconnect"
| GlobalAutoincrement | GrowDB
| GrowLog | GrowTemp
| LogDiskSpace | "RAISERROR"
| ServerIdle | TempDiskSpace
trigger-condition
:
event_condition(
condition-name
) { = | < | > | != | <= | >= }
value
schedule-spec:
[
schedule-name
]
{ START TIME
start-time
| BETWEEN
start-time
AND
end-time
}
[ EVERY
period
{ HOURS | MINUTES | SECONDS } ]
[ ON { (
day-of-week
, … ) | (
day-of-month
, … ) } ]
[ START DATE
start-date
]
event-name
|
schedule-name
:
identifier
day-of-week
:
string
day-of-month
|
value
|
period
:
integer
start-time
|
end-time
:
time
start-date
:
date
Must have DBA authority.
Function
Syntax
Permissions