问题描述:

Has anyone used an Notification Trigger successfully?

Does anyone know where I can get a sample of the string returned?

Thanks,

Howard

网友答案:

I'm not completely sure what you are looking for, but you can create a trigger that will signal an event like this:

CREATE TRIGGER MyNotifier ON EventTest
   AFTER UPDATE 
BEGIN 
   execute procedure sp_SignalEvent( 'UpdateOccurred', 
                   false, 0, 'some data' );
END; 

Then the following two statements will create the event and then wait for it (30 seconds in this example). The data that would be returned is the last parameter in the sp_SignalEvent procedure ('some data' in the above example). More realistic would be to use data that was updated in the table.

execute procedure sp_CreateEvent( 'UpdateOccurred', 2 );
execute procedure sp_WaitForEvent( 'UpdateOccurred', 30000, 0, 0 );

The documentation for sp_CreateEvent also provides an example.

相关阅读:
Top