PageRenderTime 20ms CodeModel.GetById 16ms app.highlight 3ms RepoModel.GetById 0ms app.codeStats 0ms

/Katmai_October2009_Refresh3/FastDataPush/Scripts/4 - Initiator send.sql

#
SQL | 62 lines | 21 code | 10 blank | 31 comment | 0 complexity | 76b04770c39e06433360460c709e4039 MD5 | raw file
 1--------------------------------------------------------------------
 2-- Script for fast data push sample.
 3--
 4-- This file is part of the Microsoft SQL Server Code Samples.
 5-- Copyright (C) Microsoft Corporation. All Rights reserved.
 6-- This source code is intended only as a supplement to Microsoft
 7-- Development Tools and/or on-line documentation. See these other
 8-- materials for detailed information regarding Microsoft code samples.
 9--
10-- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF
11-- ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
12-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
13-- PARTICULAR PURPOSE.
14--------------------------------------------------------------------
15
16---------------------------------------------------------------------
17-- Initiator data push.
18--
19-- This script can also be run on multiple connections to achieve transactional
20-- concurrency. Since each connection will send message_quantity messages
21-- with number_initiator_transactions transactions and number_dialogs
22-- dialogs, these parameter quantities should be divided by the number
23-- of connections to get the same total quantities.
24---------------------------------------------------------------------
25
26USE data_push_database;
27GO
28
29-- Send the messages. Output sending time.
30EXEC usp_data_push;
31GO
32
33---------------------------------------------------------------------
34-- Wait for transmission queue to be empty, signifying the
35-- reception and acknowledgement of all messages by the target.
36-- Use this efficient checking method every 5 seconds.
37---------------------------------------------------------------------
38DECLARE @count BIGINT;
39WHILE (1=1)
40BEGIN
41     SET @count =
42         (SELECT p.rows
43         FROM sys.objects AS o
44         JOIN sys.partitions AS p ON p.object_id = o.object_id
45         WHERE o.name = 'sysxmitqueue');
46     IF (@count = 0) BREAK;
47     WAITFOR DELAY '00:00:05:000';
48END;
49SELECT GETDATE() AS 'End transmission';
50GO
51
52-- View processing errors.
53SELECT * FROM initiator_processing_errors;
54GO
55
56-- View unsent messages.
57SELECT * FROM unsent_messages;
58GO
59
60
61
62