USE StockStockPrice
GO

DECLARE @ProviderName varchar(255)
DECLARE @EventBatchId bigint
DECLARE @EventCount bigint
DECLARE @RicCode varchar(6)
DECLARE @ExchangeCode varchar(6)
DECLARE @Price float(10)
DECLARE @EventClassName varchar(255)

SET @ProviderName = 'SqlStockEvents'
EXECUTE NSEventBeginBatchStockEvt @ProviderName, @EventBatchId OUTPUT
SELECT @EventBatchId As EventBatchId

SET @RicCode = 'AOL'
SET @ExchangeCode = 'NYSE'
SET @Price = 15.33 
EXECUTE NSEventWriteStockEvt @EventBatchId, @RicCode, @ExchangeCode, @Price

SET @RicCode = 'IBM'
SET @ExchangeCode = 'NYSE'
SET @Price = 123.56 
EXECUTE NSEventWriteStockEvt @EventBatchId, @RicCode, @ExchangeCode, @Price

SET @RicCode = 'SUNW'
SET @ExchangeCode = 'NASDAQ'
SET @Price = 8.00 
EXECUTE NSEventWriteStockEvt @EventBatchId, @RicCode, @ExchangeCode, @Price

SET @RicCode = 'MSFT'
SET @ExchangeCode = 'NYSE'
SET @Price = 53.33 
EXECUTE NSEventWriteStockEvt @EventBatchId, @RicCode, @ExchangeCode, @Price

SET @RicCode = 'IBM'
SET @ExchangeCode = 'LSE'
SET @Price = 125.66 
EXECUTE NSEventWriteStockEvt @EventBatchId, @RicCode, @ExchangeCode, @Price

SET @RicCode = 'IBM'
SET @ExchangeCode = 'SIX'
SET @Price = 124.66 
EXECUTE NSEventWriteStockEvt @EventBatchId, @RicCode, @ExchangeCode, @Price

SET @EventCount = 6
EXECUTE NSEventFlushBatchStockEvt @EventBatchId, @EventCount

SET @EventClassName = N'StockEvt'
EXECUTE NSEventBatchDetails @EventClassName, @EventBatchId
go

