ALTER EVENT statement

Use this statement to change the definition of an event or its associated handler for automating predefined actions, or to alter the definition of scheduled actions. You can also use this statement to hide the definition of an event handler.

Syntax 1 - Altering an event
ALTER EVENT [ owner.]event-name 
[ AT { CONSOLIDATED | REMOTE | ALL } ]
[ { DELETE TYPE 
   | TYPE event-type 
   | WHERE { trigger-condition | NULL }
   | { ADD | ALTER | DELETE } SCHEDULE schedule-spec } ]
[ ENABLE | DISABLE ]
[ [ ALTER ] HANDLER compound-statement | DELETE HANDLER ]
event-type :
  BackupEnd 
| Connect 
| ConnectFailed 
| DatabaseStart
| DBDiskSpace
| Deadlock 
| "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
value | period | day-of-month :  integer
start-time | end-time : time
start-date : date
Syntax 2 - Hiding the definition of an event handler
ALTER EVENT event-name SET HIDDEN
Parameters
  • AT clause   Use this clause to change the specification regarding the databases at which the event is handled.

  • DELETE TYPE clause   Use this clause to remove an association of the event with an event type. For a description of event types, see Understanding system events.

  • ADD | ALTER | DELETE SCHEDULE clause   Use this clause to change the definition of a schedule. Only one schedule can be altered in any one ALTER EVENT statement.

  • WHERE clause   Use this clause to change the trigger condition under which an event is fired. The WHERE NULL option deletes a condition. For descriptions of most of the parameters, see CREATE EVENT statement.

  • START TIME clause   Use this clause to specify the start time and, optionally, the end time, for the event. The start-time and end-time parameters are strings (for example, '12:34:56'). Variables and expressions are not allowed (for example, NOW()).

  • START DATE clause   Use this clause to specify the start date for the event. The start-date parameter is a string. Variables and expressions are not allowed (for example, TODAY()).

  • SET HIDDEN clause   Use this clause to hide the definition of an event handler. Specifying the SET HIDDEN clause results in the permanent obfuscation of the event handler definition stored in the action column of the ISYSEVENT system table.

Remarks

This statement allows you to alter an event definition created with CREATE EVENT. Possible uses include the following:

  • You may want to hide the definition of an event handler.

  • You may want to define and test an event handler without a trigger condition or schedule during a development phase, and then add the conditions for execution using ALTER EVENT once the event handler is completed.

If you need to alter an event, you can disable it while it is running by executing an ALTER EVENT ... DISABLE statement. To disable an event in Sybase Central, right-click the event and clear the Enabled option. Disabling the event does not interrupt current event handler execution; the event handler continues to execute until completion. When the event handler completes, it is not restarted until you re-enable it. You can alter and then re-enable the definition. To determine what events are running, execute the following statement:

SELECT * 
FROM dbo.sa_conn_info()
WHERE CONNECTION_PROPERTY('EventName',Number ) = 'event-name'
Permissions

Must have DBA authority.

Side effects

Automatic commit.

See also
Standards and compatibility
  • SQL/2003   Vendor extension.