PageRenderTime 54ms CodeModel.GetById 29ms 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. -- Initiator data push.
  17. --
  18. -- This script can also be run on multiple connections to achieve transactional
  19. -- concurrency. Since each connection will send message_quantity messages
  20. -- with number_initiator_transactions transactions and number_dialogs
  21. -- dialogs, these parameter quantities should be divided by the number
  22. -- of connections to get the same total quantities.
  23. ---------------------------------------------------------------------
  24. USE data_push_database;
  25. GO
  26. -- Send the messages. Output sending time.
  27. EXEC usp_data_push;
  28. GO
  29. ---------------------------------------------------------------------
  30. -- Wait for transmission queue to be empty, signifying the
  31. -- reception and acknowledgement of all messages by the target.
  32. -- Use this efficient checking method every 5 seconds.
  33. ---------------------------------------------------------------------
  34. DECLARE @count BIGINT;
  35. WHILE (1=1)
  36. BEGIN
  37. SET @count =
  38. (SELECT p.rows
  39. FROM sys.objects AS o
  40. JOIN sys.partitions AS p ON p.object_id = o.object_id
  41. WHERE o.name = 'sysxmitqueue');
  42. IF (@count = 0) BREAK;
  43. WAITFOR DELAY '00:00:05:000';
  44. END;
  45. SELECT GETDATE() AS 'End transmission';
  46. GO
  47. -- View processing errors.
  48. SELECT * FROM initiator_processing_errors;
  49. GO
  50. -- View unsent messages.
  51. SELECT * FROM unsent_messages;
  52. GO