Advantage SQL Engine

  Previous topic Next topic  

This procedure allows a client to create an event of the given name. Once it has created the event, a client will start receiving notifications whenever that event is signaled whether or not the client is actively waiting for the event or not. If the client is not actively waiting, the event will be saved by the server until the client application waits for the event.


If the ADS_EVENT_WITH_DATA (2) option is set, the event will accept string data of any size.  A user must create the event with the data option in order to receive event data from a signal.  Events created without the data option will not return event data even if the signal provided event data.

Each connection that is interested in a specific event must call sp_CreateEvent. When an event of a given name is signaled, the event notification will be sent to all connections that have called sp_CreateEvent for that event name.


Note: Multiple local server users connecting to the same data dictionary must use the same connection path in order to share event notifications. Specifically if one user is connecting to the data dictionary on a local drive (e.g. C:\), then they must use the same path as any remote users to share event notifications (e.g. \\server\share). Our recommendation is to use UNC paths for all users.


sp_CreateEvent( EventName, CiCharacter, 200,

               Options, integer );



EventName (I)

Name of the event to register.

Options (I)

Options, reserved for future use, pass the value 0 for this parameter.


See Also








// NOTE: This example requires a data dictionary connection

// Create an event that accepts data

EXECUTE PROCEDURE sp_CreateEvent( 'my_event', 2 /* ADS_EVENT_WITH_DATA */ );
// Create a simple test table
CREATE TABLE my_table ( name char (10));
// Create a trigger that signals the event and includes the ROWID of the updated record
  EXECUTE PROCEDURE sp_SignalEvent( 'my_event', false, 0, ::stmt.TrigRowID );
// A simple INSERT will fire the trigger and signal the event
INSERT INTO my_table VALUES ( 'Charles' );
// Now when we get the signal we can use the ROWID to find the updated record
SELECT * FROM my_Table WHERE ROWID = ( SELECT StringData FROM ( EXECUTE PROCEDURE sp_WaitForEvent( 'my_event', 0, 0, 0 )) Sig );