Example: Passing parameters to an asynchronous event

This sample code passes parameters to an asynchronous event:

DECLARE @EventParmId AS UNIQUEIDENTIFIER = NEWID()
EXEC InsertEventInputParameterSp @MyEventParmId, 'Parameter1', @Variable1
EXEC InsertEventInputParameterSp @MyEventParmId, 'Parameter2', @Variable2
EXEC InsertEventInputParameterSp @MyEventParmId, 'OutParameter3', NULL, 1
DECLARE @SessionID AS UNIQUEIDENTIFIER = dbo.SessionIDSp()
DECLARE @Unused AS BIT = 0
DECLARE @Result EventResultType
DECLARE @Infobar InfobarType
EXEC dbo.FireEventSp
   @EventName = 'MyEvent',
   @ConfigName = 'MyConfiguration',
   @Initiator = 'MyInititator',
   @SessionID = @SessionID,
   @EventParmId = @MyEventParmId,
   @EventTrxId = NULL,
   @Transactional = 0,
   @GeneratingEventActionStateRowPointer = NULL,
   @AnyHandlersFailed = @Unused OUTPUT,
   @Result = @Result OUTPUT,
   @Infobar = @Infobar OUTPUT