Creates a new event batch for a Microsoft SQL Server Notification Services application. You typically use this stored procedure to open a new event batch so you can submit individual events using Transact-SQL. See the Remarks section for more information.
- [ @ProviderName =] 'event_provider_name'
Is the name of the event provider submitting the events. event_provider_name is nvarchar(255) and has no default value.
- [ @EventBatchId =] event_batch_variable OUTPUT
Is the event batch identification number assigned to the event batch if the batch is created successfully. event_batch_variable is an output variable of type bigint, with no default value.
Notification Services creates the NSEventBeginBatchEventClassName stored procedure in the application database when you create the instance. When you update the application, Notification Services recompiles the stored procedure.
This stored procedure is in the application's schema, which is specified by the SchemaName element of the application definition file (ADF). If no schema name is provided, the default schema is dbo.
To submit individual events to an application using Transact-SQL, use NSEventBeginBatchEventClassName to open the batch, NSEventWriteEventClassName to write individual events, and NSEventFlushBatchEventClassName to close the event batch.
To use a query to obtain a set of events and then submit them to an application, use NSEventSubmitBatchEventClassName.
The following example shows how to begin an event batch, write one event, and then close the event batch. The event provider for the event batch is StockEP and the event batch ID number is returned in the @BatchID output parameter.
The application uses the default SchemaName settings, which places all application objects in the dbo schema.
DECLARE @BatchID bigint; EXEC dbo.NSEventBeginBatchStockEvents N'StockEP', @BatchID OUTPUT; EXEC dbo.NSEventWriteStockEvents @EventBatchId=@BatchID, @StockSymbol=N'AWKS', @StockPrice=68.14; EXEC dbo.NSEventFlushBatchStockEvents @BatchID; SELECT @BatchID 'Event Batch';
This example assumes that you are using SQL Server Management Studio because the event batch ID is returned in the SELECT statement so you can see which event batch was created.
ReferenceNotification Services Stored Procedures (Transact-SQL)
Other ResourcesNotification Services Performance Reports
SchemaName Element (ADF)