A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  special characters  sybase-tech-blog


Category: IQ: events

CREATE EVENT

The CREATE EVENT command defines events with a corresponding processing routine used to automate repetetive tasks. Already created events can be retrieved from the system table SYSEVENT.

    SELECT event_id, event_name FROM SYSEVENT

CREATE EVENT: Syntax

    CREATE EVENT event_name
      [ TYPE event_typ
      [ WHERE trigger_condition [ AND trigger_condition ] ... ]
      | SCHEDULE schedule_declaration, ... ]
      [ ENABLE | DISABLE ]
      [ AT { CONSOLIDATED | REMOTE | ALL } ]
      [ HANDLER
      BEGIN
      ...
      END ]

Parameters of the CREATE EVENT command

event_name
A descriptive name for an event.

event_type:
Describes the type of an event. event_type can be any of the "case insensitive" values from the list below:

    BackupEnd 
    | 'Connect'
    | ConnectFailed 
    | DatabaseStart
    | DBDiskSpace 
    | 'Disconnect'
    | GlobalAutoincrement 
    | GrowDB
    | GrowLog 
    | GrowTemp 
    | LogDiskSpace 
    | MirrorFailover
    | MirrorServerDisconnect 
    | 'RAISERROR'
    | ServerIdle 
    | TempDiskSpace

In order to trigger an event, it must be combined with a WHERE clause, for example:

    ...
    WHERE event_condition( 'LogDiskSpacePercentFree' ) < 20
    ...

trigger-condition:
Defines the conditions required to start the event.

    event_condition(condition_name) { = | < | > | != | <= | >= } value

schedule_declaration Defines the point in time when the event is triggered.

    [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]

day_of_week, day_of_month, value and period
define time periods and intervals (period) in which the event can be triggered.

schedule_name
Is the name for a corresponding time frame.