扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:builder.com.cn 2007年3月2日
关键字: SQL Server
在本页阅读全文(共4页)
CREATE PROCEDURE usp_RecordSaleMessage
AS
BEGIN
SET NOCOUNT ON;
DECLARE @Handle UNIQUEIDENTIFIER;
DECLARE @MessageType SYSNAME;
DECLARE @Message XML
DECLARE @SaleDate DATETIME
DECLARE @SaleAmount MONEY
DECLARE @ItemsSold INT;
RECEIVE TOP (1)
@Handle = conversation_handle,
@MessageType = message_type_name,
@Message = message_body
FROM [SalesQueue];
IF(@Handle IS NOT NULL AND @Message IS NOT NULL)
BEGIN
SELECT @SaleDate = CAST(CAST(@Message.query('/Params/SaleDate/text()') AS NVARCHAR(MAX)) AS DATETIME)
SELECT @SaleAmount = CAST(CAST(@Message.query('/Params/SaleAmount/text()') AS NVARCHAR(MAX)) AS MONEY)
SELECT @ItemsSold = CAST(CAST(@Message.query('/Params/ItemsSold/text()') AS NVARCHAR(MAX)) AS INT)
INSERT INTO Sales(SaleDate ,SaleAmount ,ItemsSold )
VALUES(@SaleDate,@SaleAmount,@ItemsSold);
END
END
GO
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。