Clearing All Messages From A Queue - For Automated Unit Test

Jun 4, 2007

Hi,

I am developing automated .Net Unit Tests, and as a prerequisite of each test, I would like to clear the service broker queues of any messages. Executing the

RECEIVE * FROM statement appears to only return a message at a time, and not all as I expected. Any ideas on how to make this happen, besides not having to delete the queues and then having to rebuild them?

Thanks,Eugen

View 3 Replies


ADVERTISEMENT

Unit Testing For SSIS - To Test Or Not To Test?

Oct 17, 2006

Now that we have a good programming model in SSIS - the question is whether to write automated unit tests for your packages, and would it generally be a good idea for packages?

Also - if yes to write tests - then where to find more informations regarding How to accomplish that?

View 1 Replies View Related

How To Use Unit Test In SSIS

May 8, 2007

I build a SSIS Package in Visual Studio 2005 , but i don't know how to test it automated?

View 7 Replies View Related

How To Clean All Messages Of A Queue ?

Sep 22, 2005

    How to clean all messages of a queue ?

View 5 Replies View Related

Receive All Messages On Queue

Feb 12, 2007

Hi i am trying to create a batch process then commit for all messages on the queue. The problem i am having is when i run my query (As below) I only receive the first message and the corresponding end dialog for the message although i have 2000 records sitting in the queue. It is my understanding that receive without any criteria i.e top(1) or where clause should select everything of the queue. I tried receive top(100) expecting 100 records but still only got 2 back.

any help appreciated.



WAITFOR(RECEIVE

queuing_order,

conversation_handle,

message_type_name,

message_body

FROM [RMIS_COMMS_Queue]

INTO @tableMessages), TIMEOUT 2000;



View 4 Replies View Related

Messages Stuck In Transmission Queue

Feb 27, 2008

I have a strange problem with messages getting stuck in a transmission queue. The set up is as follows:

1. Client database behind physical firewall
2. Firewall rules forward inbound traffic to Client Database
3. Server database has route to firewall
4. Client and Server databases on different physical networks

Over the last couple of days, the IP address of the PC that has the Client database on it changed. Messages were getting through to the Server from the Client but not the other way round. I presume this also meant that message acknowledgements were also not getting back to the Client because messages were stuck in the Client transmission queue.

Looking in more detail at the queued messages at the Server side, it appeared that the Server had received the messages, processed them, and sent back an end conversation. The state of the conversation in conversation_endpoints was DISCONNECTED OUTBOUND. Which I assume means that these would never get through to the Client?

What is the correct way of dealing with this situation? I tried doing an end conversation with cleanup at the Server end but this is clearly wrong because this removes any trace of the conversation from the Server and means that the messages now get through correclty (again) and processed (again). Meaning that we now have duplicate messages in our database.

Any help would be much appreciated.
Thanks.

View 3 Replies View Related

Messages Stopped Appearing In Queue!

Aug 28, 2007

I recently restored my database from a backup and it seems that something in my service broker setup has stopped working, no messages now appear.

I checked that the broker was enabled (it wasnt and i had to use NEW_BROKER because of the 'same id' message)

The database is still set to trustyworthy.

There are also no messages in sys.transmission_queue


I used profiler with all the broker events enabled and the result was as follows:


Broker:Conversation Group
Broker:Conversation STARTED_OUTBOUND
Broker:Conversation CONVERSING
Broker:Message Classify
Broker:Conversation CLOSED
Broker:Conversation Group
Broker:Message Classify


But i'm not sure whether this highlights a problem or not? Any help gratefully appreciated!!

Thanks,

Andy

View 1 Replies View Related

Messages In The Sys.transmission_queue For A Disable Queue

Feb 28, 2007

I may have a misunderstanding of how SB works, but this seems like a problem.

If a queue is disable (i.e. status = off) and a message is sent to the queue the message is placed on the sys.transmission_queue. Once the queue is enabled I thought the messages were sent to the queue in the order they were placed on the sys.tranmission_queue? I have been troubleshooting a problem and this is not the case. Do I have a misunderstanding of how the sys.transmission_queue works?

The queue has retention turned off.

View 4 Replies View Related

Auto Process Messages In Target Queue

Mar 25, 2006

I am little confused with this statement, can please some one clarify!

Create QUEUE ReceiverQueue WITH STATUS = ON,

ACTIVATION ( PROCEDURE_NAME = dbo.process, MAX_QUEUE_READERS = 1, EXECUTE AS 'dbo' )

Does this mean when a message reaches to ReceiverQueue, it will automatically processed by dbo.Process procedure

Create PROC dbo.process As

Begin

DECLARE @conversationHandle UNIQUEIDENTIFIER

DECLARE @message_body varchar(100)

DECLARE @rid int

Begin Transaction;

While (1=1)

Begin

RECEIVE TOP(1)

@rid = Cast(Convert(Nvarchar(max),message_body) as int)

From ReceiverQueue

If (@@RowCount = 0 Or @@ERROR <> 0 ) Break



Exec PriceChange.Extract_AS400Data @rid



End

Commit Transaction;

End

Or do I have to put WAITFOR statement in my stored proc (dbo.Process) to run it continously.

Please guide

Thanks

View 5 Replies View Related

Receive Messages From Queue Based On Message_type_name

Dec 15, 2006

I have 2 messages types for a queue and would like to use one application that receives messages of one type from the queue and another application that will receieve messages of a different type from the same queue.

Is that possible and if yes how?

SampK

View 1 Replies View Related

SQL Service Broker - How To Resend Messages In Sender Transmission Queue?

Nov 26, 2007



I have a question about SQL Service Broker.

Here are the steps I use to produce the issue.

1) I drop the Service Broker on the Receiver by running the following sql script:


if exists (select * from sys.services where name = N'//TyMetrix360Audit/DataWriter') drop service [//TyMetrix360Audit/DataWriter]

2) I send some messages using the SQL Service broker on the sender side

3) The messages I send stay in sender transmission queue. Here is an example of what my transmission queue looks like after running select * from sys.transmission_queue on the sender.


02C54400-309C-DC11-8EED-0002B3D9F7B5 //TyMetrix360Audit/DataWriter 386DDD04-7E55-466A-BE83-37EFC20910B9 tcp://SFT3DEVSQL01:4022/TyMetrix360Audit/DataSender //TyMetrix360Audit/Contract 2007-11-26 14:58:10.207 0 //TyMetrix360Audit/Message 0 0 0x3C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022007500740066002D003100360022003F003E000D000A003C0045006E0074006500720070007200690073006500410075006400690074004400610074006100200078006D006C006E0073003A007800730069003D00220068007400740070003A002F002F007700770077002E00770033002E006F00720067002F0032003000300031002F0058004D004C0053006300680065006D0061002D0069006E007300740061006E00630065002200200078006D006C006E0073003A007800730064003D00220068007400740070003A002F002F007700770077002E00770033002E006F00720067002F0032003000300031002F0058004D004C0053006300680065006D00610022003E000D000A00200020003C005400610062006C0065004E0061006D0065003E004E004500540057004F0052004B003C002F005400610062006C0065004E0061006D0065003E000D000A00200020003C005000720069006D0061007200790043006F006C0075006D006E004E0061006D0065003E006E006500740077006F0072006B005F00690064003C002F005000720069006D0061007200790043006F006C0075006D006E004E0061006D0065003E000D000A00200020003C004F007000650072006100740069006F006E003E0055003C002F004F007000650072006100740069006F006E003E000D000A00200020003C004400620055007300650072003E00640062006F003C002F004400620055007300650072003E000D000A00200020003C004400610074006100620061007300650020002F003E000D000A00200020003C0044006100740061003E000D000A0020002000200020003C00780073003A0073006300680065006D0061002000690064003D0022004E006500770044006100740061005300650074002200200078006D006C006E0073003D0022002200200078006D006C006E0073003A00780073003D00220068007400740070003A002F002F007700770077002E00770033002E006F00720067002F0032003000300031002F0058004D004C0053006300680065006D0061002200200078006D006C006E0073003A006D00730064006100740061003D002200750072006E003A0073006300680065006D00610073002D006D006900630072006F0073006F00660074002D0063006F006D003A0078006D006C002D006D007300640061007400610022003E000D000A002000200020002000200020003C00780073003A0065006C0065006D0065006E00740020006E0061006D0065003D0022004E00650077004400610074006100530065007400220020006D00730064006100740061003A004900730044006100740061005300650074003D0022007400720075006500220020006D00730064006100740061003A004D00610069006E0044006100740061005400610062006C0065003D0022004400610074006100220020006D00730064006100740061003A00550073006500430075007200720065006E0074004C006F00630061006C0065003D002200740072007500650022003E000D000A00200020002000200020002000200020003C00780073003A0063006F006D0070006C006500780054007900700065003E000D000A0020002000200020002000200020002000200020003C00780073003A00630068006F0069006300650020006D0069006E004F00630063007500720073003D0022003000220020006D00610078004F00630063007500720073003D00220075006E0062006F0075006E0064006500640022003E000D000A002000200020002000200020002000200020002000200020003C00780073003A0065006C0065006D0065006E00740020006E0061006D0065003D002200440061007400610022003E000D000A00200020002000200020002000200020002000200020002000200020003C00780073003A0063006F006D0070006C006500780054007900700065003E000D000A0020002000200020002000200020002000200020002000200020002000200020003C00780073003A00730065007100750065006E00630065003E000D000A002000200020002000200020002000200020002000200020002000200020002000200020003C00780073003A0065006C0065006D0065006E00740020006E0061006D0065003D0022006E006500740077006F0072006B005F00690064002200200074007900700065003D002200780073003A0069006E007400220020006D0069006E004F00630063007500720073003D0022003000220020002F003E000D000A002000200020002000200020002000200020002000200020002000200020002000200020003C00780073003A0065006C0065006D0065006E00740020006E0061006D0065003D0022006E006500740077006F0072006B005F006E0061006D0065002200200074007900700065003D002200780073003A0073007400720069006E006700220020006D0069006E004F00630063007500720073003D0022003000220020002F003E000D000A0020002000200020002000200020002000200020002000200020002000200020003C002F00780073003A00730065007100750065006E00630065003E000D000A00200020002000200020002000200020002000200020002000200020003C002F00780073003A0063006F006D0070006C006500780054007900700065003E000D000A002000200020002000200020002000200020002000200020003C002F00780073003A0065006C0065006D0065006E0074003E000D000A0020002000200020002000200020002000200020003C002F00780073003A00630068006F006900630065003E000D000A00200020002000200020002000200020003C002F00780073003A0063006F006D0070006C006500780054007900700065003E000D000A002000200020002000200020003C002F00780073003A0065006C0065006D0065006E0074003E000D000A0020002000200020003C002F00780073003A0073006300680065006D0061003E000D000A0020002000200020003C006400690066006600670072003A0064006900660066006700720061006D00200078006D006C006E0073003A006D00730064006100740061003D002200750072006E003A0073006300680065006D00610073002D006D006900630072006F0073006F00660074002D0063006F006D003A0078006D006C002D006D00730064006100740061002200200078006D006C006E0073003A006400690066006600670072003D002200750072006E003A0073006300680065006D00610073002D006D006900630072006F0073006F00660074002D0063006F006D003A0078006D006C002D0064006900660066006700720061006D002D007600310022003E000D000A002000200020002000200020003C0044006F00630075006D0065006E00740045006C0065006D0065006E0074003E000D000A00200020002000200020002000200020003C00440061007400610020006400690066006600670072003A00690064003D00220044006100740061003100220020006D00730064006100740061003A0072006F0077004F0072006400650072003D002200300022003E000D000A0020002000200020002000200020002000200020003C006E006500740077006F0072006B005F00690064003E0031003C002F006E006500740077006F0072006B005F00690064003E000D000A0020002000200020002000200020002000200020003C006E006500740077006F0072006B005F006E0061006D0065003E00780066006400660064006600640066003C002F006E006500740077006F0072006B005F006E0061006D0065003E000D000A00200020002000200020002000200020003C002F0044006100740061003E000D000A002000200020002000200020003C002F0044006F00630075006D0065006E00740045006C0065006D0065006E0074003E000D000A0020002000200020003C002F006400690066006600670072003A0064006900660066006700720061006D003E000D000A00200020003C002F0044006100740061003E000D000A00200020003C004F007000650072006100740069006F006E00540069006D0065003E0032003000300037002D00310031002D00320036005400310034003A00350038003A00310030002E0030003900380036003100350035005A003C002F004F007000650072006100740069006F006E00540069006D0065003E000D000A00200020003C0042006C006F00620043006F006C0075006D006E004E0061006D006500730020002F003E000D000A00200020003C0042006C006F00620047005500490044003E00630061006200610037006500660039002D0066003500650065002D0034006200370035002D0061006400360030002D003000390063003500330038003500640031003100310031003C002F0042006C006F00620047005500490044003E000D000A003C002F0045006E00740065007200700072006900730065004100750064006900740044006100740061003E00 Service Broker received an error message on this conversation. Service Broker will not transmit the message; it will be held until the application ends the conversation.
F620FA2D-309C-DC11-8EED-0002B3D9F7B5 //TyMetrix360Audit/DataWriter 386DDD04-7E55-466A-BE83-37EFC20910B9 tcp://SFT3DEVSQL01:4022/TyMetrix360Audit/DataSender //TyMetrix360Audit/Contract 2007-11-26 14:59:26.813 0 //TyMetrix360Audit/Message 0 0 0x3C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022007500740066002D003100360022003F003E000D000A003C0045006E0074006500720070007200690073006500410075006400690074004400610074006100200078006D006C006E0073003A007800730069003D00220068007400740070003A002F002F007700770077002E00770033002E006F00720067002F0032003000300031002F0058004D004C0053006300680065006D0061002D0069006E007300740061006E00630065002200200078006D006C006E0073003A007800730064003D00220068007400740070003A002F002F007700770077002E00770033002E006F00720067002F0032003000300031002F0058004D004C0053006300680065006D00610022003E000D000A00200020003C005400610062006C0065004E0061006D0065003E004E004500540057004F0052004B003C002F005400610062006C0065004E0061006D0065003E000D000A00200020003C005000720069006D0061007200790043006F006C0075006D006E004E0061006D0065003E006E006500740077006F0072006B005F00690064003C002F005000720069006D0061007200790043006F006C0075006D006E004E0061006D0065003E000D000A00200020003C004F007000650072006100740069006F006E003E0055003C002F004F007000650072006100740069006F006E003E000D000A00200020003C004400620055007300650072003E00640062006F003C002F004400620055007300650072003E000D000A00200020003C004400610074006100620061007300650020002F003E000D000A00200020003C0044006100740061003E000D000A0020002000200020003C00780073003A0073006300680065006D0061002000690064003D0022004E006500770044006100740061005300650074002200200078006D006C006E0073003D0022002200200078006D006C006E0073003A00780073003D00220068007400740070003A002F002F007700770077002E00770033002E006F00720067002F0032003000300031002F0058004D004C0053006300680065006D0061002200200078006D006C006E0073003A006D00730064006100740061003D002200750072006E003A0073006300680065006D00610073002D006D006900630072006F0073006F00660074002D0063006F006D003A0078006D006C002D006D007300640061007400610022003E000D000A002000200020002000200020003C00780073003A0065006C0065006D0065006E00740020006E0061006D0065003D0022004E00650077004400610074006100530065007400220020006D00730064006100740061003A004900730044006100740061005300650074003D0022007400720075006500220020006D00730064006100740061003A004D00610069006E0044006100740061005400610062006C0065003D0022004400610074006100220020006D00730064006100740061003A00550073006500430075007200720065006E0074004C006F00630061006C0065003D002200740072007500650022003E000D000A00200020002000200020002000200020003C00780073003A0063006F006D0070006C006500780054007900700065003E000D000A0020002000200020002000200020002000200020003C00780073003A00630068006F0069006300650020006D0069006E004F00630063007500720073003D0022003000220020006D00610078004F00630063007500720073003D00220075006E0062006F0075006E0064006500640022003E000D000A002000200020002000200020002000200020002000200020003C00780073003A0065006C0065006D0065006E00740020006E0061006D0065003D002200440061007400610022003E000D000A00200020002000200020002000200020002000200020002000200020003C00780073003A0063006F006D0070006C006500780054007900700065003E000D000A0020002000200020002000200020002000200020002000200020002000200020003C00780073003A00730065007100750065006E00630065003E000D000A002000200020002000200020002000200020002000200020002000200020002000200020003C00780073003A0065006C0065006D0065006E00740020006E0061006D0065003D0022006E006500740077006F0072006B005F00690064002200200074007900700065003D002200780073003A0069006E007400220020006D0069006E004F00630063007500720073003D0022003000220020002F003E000D000A002000200020002000200020002000200020002000200020002000200020002000200020003C00780073003A0065006C0065006D0065006E00740020006E0061006D0065003D0022006E006500740077006F0072006B005F006E0061006D0065002200200074007900700065003D002200780073003A0073007400720069006E006700220020006D0069006E004F00630063007500720073003D0022003000220020002F003E000D000A0020002000200020002000200020002000200020002000200020002000200020003C002F00780073003A00730065007100750065006E00630065003E000D000A00200020002000200020002000200020002000200020002000200020003C002F00780073003A0063006F006D0070006C006500780054007900700065003E000D000A002000200020002000200020002000200020002000200020003C002F00780073003A0065006C0065006D0065006E0074003E000D000A0020002000200020002000200020002000200020003C002F00780073003A00630068006F006900630065003E000D000A00200020002000200020002000200020003C002F00780073003A0063006F006D0070006C006500780054007900700065003E000D000A002000200020002000200020003C002F00780073003A0065006C0065006D0065006E0074003E000D000A0020002000200020003C002F00780073003A0073006300680065006D0061003E000D000A0020002000200020003C006400690066006600670072003A0064006900660066006700720061006D00200078006D006C006E0073003A006D00730064006100740061003D002200750072006E003A0073006300680065006D00610073002D006D006900630072006F0073006F00660074002D0063006F006D003A0078006D006C002D006D00730064006100740061002200200078006D006C006E0073003A006400690066006600670072003D002200750072006E003A0073006300680065006D00610073002D006D006900630072006F0073006F00660074002D0063006F006D003A0078006D006C002D0064006900660066006700720061006D002D007600310022003E000D000A002000200020002000200020003C0044006F00630075006D0065006E00740045006C0065006D0065006E0074003E000D000A00200020002000200020002000200020003C00440061007400610020006400690066006600670072003A00690064003D00220044006100740061003100220020006D00730064006100740061003A0072006F0077004F0072006400650072003D002200300022003E000D000A0020002000200020002000200020002000200020003C006E006500740077006F0072006B005F00690064003E0031003C002F006E006500740077006F0072006B005F00690064003E000D000A0020002000200020002000200020002000200020003C006E006500740077006F0072006B005F006E0061006D0065003E00780066006400660064006600640066003C002F006E006500740077006F0072006B005F006E0061006D0065003E000D000A00200020002000200020002000200020003C002F0044006100740061003E000D000A002000200020002000200020003C002F0044006F00630075006D0065006E00740045006C0065006D0065006E0074003E000D000A0020002000200020003C002F006400690066006600670072003A0064006900660066006700720061006D003E000D000A00200020003C002F0044006100740061003E000D000A00200020003C004F007000650072006100740069006F006E00540069006D0065003E0032003000300037002D00310031002D00320036005400310034003A00350039003A00320036002E0037003800340036003400330031005A003C002F004F007000650072006100740069006F006E00540069006D0065003E000D000A00200020003C0042006C006F00620043006F006C0075006D006E004E0061006D006500730020002F003E000D000A00200020003C0042006C006F00620047005500490044003E00350034006300380036006200330036002D0061006300330066002D0034006600300034002D0062006600660066002D003400310062003800310065003500360035006500360066003C002F0042006C006F00620047005500490044003E000D000A003C002F0045006E00740065007200700072006900730065004100750064006900740044006100740061003E00 Service Broker received an error message on this conversation. Service Broker will not transmit the message; it will be held until the application ends the conversation.


The main point is that the sys.transmission queue retains the messages with the error 'Service Broker will not transmit the message; it will be held until the application ends the conversation.'

4. I execute the following sql statment on the sender:

select * from sys.conversation_endpoints

and see that the conversation that sent the messages are in state 'ER'

5. I then recreate the receiver with the following script:


create service [//TyMetrix360Audit/DataWriter] authorization dbo on queue dbo.TyMetrix360AuditQueue([//TyMetrix360Audit/Contract])

6. I send some more messages and see that the new messages are being received and processed correctly.

7. But what of the messages stuck in the sender transmission queue. How are these messages to be resent? Since the conversations are in state 'ER' it seems they are not being resent. Do I need to write a custom SQL script to resend them? I do not want to end the conversation because the message will be lost and not resent.


So, in conclusion, the main question is:

When the receiver goes down, or the receiver service broker simply does not exist and messages pile up the sender transmission queue like in my example how do these messages get resent when the receiver is restored?

By the way when I run

select service_broker_guid from sys.databases where database_id = db_id()

I get the same GUID after the server is restored.

Thanks

View 5 Replies View Related

SQL Service Broker - How To Resend Messages Stuck In Sender Transmission Queue

Nov 26, 2007

Here is a description:

1. drop receiver side service broker with sql command : drop service [//TyMetrix360Audit/DataWriter]

2. send a message from the sender.

3. now the sys.transmission_queue on the sender keeps the message.

The relevant tables on the sender and receiver no look like this:

the following summarizes the transmission queue on the SENDER:

conversation handle message_body transmission status
5A0F1D1F-449C-DC11-8EED-0002B3D9F7B5 my message in binary, ie 0x.F4E1.... <blank>

the following summarizes the sys.conversation_endpoints on the SENDER:

conversation handle conversation_id state
5A0F1D1F-449C-DC11-8EED-0002B3D9F7B5 461891C8-5D53-4D89-A7C6-097FE2EDB22A CO

the following summarizes the transmission queue on the RECEIVER:

conversation handle message_body transmission status
5A0F1D1F-449C-DC11-8EED-0002B3D9F7B5 message body of error message...... One or more messages could not be delivered to the local service targeted by this dialog.

the following summarizes the sys.conversation_endpoints on the RECEIVER:

conversation handle conversation_id state
5A0F1D1F-449C-DC11-8EED-0002B3D9F7B5 461891C8-5D53-4D89-A7C6-097FE2EDB22A DO


What do I do now?

There is a message stuck in the sender transmission queue. You responded in my last post that I need to do a RECIEVE on the sender and end the conversation myself? This is not helping me. I am still confused about the answer to this. Can you provide some sort of code outline or steps to resolve this issue. As of now I do not know how to resend my messages stuck in the sender transmission queue and they can not be lost when the conversation is ended.

Also, I thought SQL Service broker was supposed to hadle things like this. It is common for the receiver to not be there. In this case the messages should resend automatically once the receiver is back up. Please help as there is no documentation online about how to resolve this issue and your last response was not adequate.

Thanks

View 3 Replies View Related

Initiator Running On SQL Express Edition Get Extra Messages From Target In Transmission Queue

Mar 11, 2008

Scenario: (1) Initiator/Target are running on different machines; (2) Target is on SQL Standard Edition with service pack 1; (3) Initiator ends the conversation.

If Initiator is running on SQL Express Edition with service pack 1 or 2, €œSend message€? and €œEnd conversion€? will introduce two messages in initiator€™s sys.transmission_queue. One is empty message with correct message type; the other is empty message with no message type. Both of them are from the Target to the Initiator.

If Initiator is running on SQL Standard Edition with service pack 1, with same stored procedure (attached below), there is no message left in initiator€™s sys.transmission_queue.

We like to find the way to make Initiator on SQL Express Edition acting same as it on SQL Standard Edition, namely not left messages in the initiator€™s sys.transmission_queue

CREATE PROCEDURE [dbo].[CreateMessageForQueue]
@message varchar(max)
AS
BEGIN

SET NOCOUNT ON;

DECLARE @handle UNIQUEIDENTIFIER;

BEGIN DIALOG CONVERSATION @handle
FROM SERVICE [TCP://Initiator:4321]
TO SERVICE N'TCP://Target:4567'
ON CONTRACT LogContract
WITH ENCRYPTION = OFF;

SEND ON CONVERSATION @handle
MESSAGE TYPE LogMessage(@message);

END CONVERSATION @handle
END




Thanks,

View 2 Replies View Related

Obtain Unit Percent With Unit Count Divided By Total Count In Query

Aug 21, 2007

The following query returns a value of 0 for the unit percent when I do a count/subquery count. Is there a way to get the percent count using a subquery? Another section of the query using the sum() works.

Here is a test code snippet:


--Test Count/Count subquery

declare @Date datetime

set @date = '8/15/2007'


select
-- count returns unit data
Count(substring(m.PTNumber,3,3)) as PTCnt,
-- count returns total for all units

(select Count(substring(m1.PTNumber,3,3))

from tblVGD1_Master m1

left join tblVGD1_ClassIII v1 on m1.SlotNum_ID = v1.SlotNum_ID

Where left(m1.PTNumber,2) = 'PT' and m1.Denom_ID <> 9

and v1.Act = 1 and m1.Active = 1 and v1.MnyPlyd <> 0

and not (v1.MnyPlyd = v1.MnyWon and v1.ActWin = 0)

and v1.[Date] between DateAdd(dd,-90,@Date) and @Date) as TotalCnt,
-- attempting to calculate the percent by PTCnt/TotalCnt returns 0
(Count(substring(m.PTNumber,3,3)) /

(select Count(substring(m1.PTNumber,3,3))

from tblVGD1_Master m1

left join tblVGD1_ClassIII v1 on m1.SlotNum_ID = v1.SlotNum_ID

Where left(m1.PTNumber,2) = 'PT' and m1.Denom_ID <> 9

and v1.Act = 1 and m1.Active = 1 and v1.MnyPlyd <> 0

and not (v1.MnyPlyd = v1.MnyWon and v1.ActWin = 0)

and v1.[Date] between DateAdd(dd,-90,@Date) and @Date)) as AUPct
-- main select

from tblVGD1_Master m

left join tblVGD1_ClassIII v on m.SlotNum_ID = v.SlotNum_ID

Where left(m.PTNumber,2) = 'PT' and m.Denom_ID <> 9

and v.Act = 1 and m.Active = 1 and v.MnyPlyd <> 0

and not (v.MnyPlyd = v.MnyWon and v.ActWin = 0)

and v.[Date] between DateAdd(dd,-90,@Date) and @Date

group by substring(m.PTNumber, 3,3)

order by AUPct Desc


Thanks. Dan

View 1 Replies View Related

Clarifications On Queue Service And Queue Readers

Jan 11, 2006

Hello,
This is info that I am still not certain about and I just need to make sure, my gut feeling is correct:

A.
When a procedure is triggered upon reception of a message in a queue, what happens when the procedure fails and rolls back?
1. Message is left on the Queue.
2. is the worker procedure triggered again for the same message by the queue?
3. I am hoping the Queue keeps on triggering workers until it is empty.

My scenario is that my queue reader procedure only reads one message at a time, thus I do not loop to receive many messages.

B.
For my scenario messages are independent and ordering does not matter.
Thus I want to ensure my Queue reader procedures execute simultaneously. Is reading the Top message in one reader somehow blocking the queue for any other reader procedures? I.e. if I have BEGIN TRANSACTION when reading messages of the Queue, is that effectively going prevent many reader procedures working simultaneously. Again, I want to ensure that Service broker is effectively spawning procedures that work simultaneously.

Thank you very much for the time,

Lubomir

View 5 Replies View Related

DB Engine :: Replicate A Master Test Database To 100 Test Environments?

Oct 12, 2015

We are setting up a test lab environment with 100 machines.  We want one master testing db that gets replicated to each to run scripted application tests nightly.  

My goal is to minimize the amount of work to move this thing to each of the 100 test machines.  I am wondering if we need to even have the sql local and invest in a monster db server with 100 copies of the db we restore and each test machine point to their own db on that server, or if I should use db mirroring or something to get the master test db to each of those machines instead.

View 6 Replies View Related

How To Test SSis Package And What Are The Things I Need To Test It ?

Nov 27, 2007



hi every one,
i need to test SSIS pacakge which will import data from different database where record count is around 5 millions.
iam planning to test it through c# code as well as manually also.
SSIS source : consist of 7 tables
SSIS destination :consist of 7 tables
Using c# code iam trying to run ssis package through batch file.
i am putting expected rowcount, column count in an excel file and comparing same with destination tables by writing query implementing ADO.Net concept.
am i going right way ,can any one suggest best and productive way to test the ssis package .
what are the other things i need to test it.
do any one can add test cases to it.






S.No

Test Case


1

Verify all the tables have been imported.



2

Verify all the rows in each table have been imported.



3

Verify all the columns specified in source query for each table have been imported


4

Verify all the data has been received without any truncation for each column.



5

Verify the schema at source and destination



6

Verify the time taken /speed for data transfer


7

Fields truncated due to difference in length of the field at destination.
Regards
Arif shareef

View 9 Replies View Related

Unit Testing

Oct 1, 2005

I've started researching on Unit Testing and I must admitI had never heard of Unit Testing until a couple of monthsago. Obviously I am interested in Unit Testing StoredProcedures.I read the TSQLUnit documentation (not all of it) and i also raninto a newsgroup post saying TSQLUnit is very small comparedto NUnit. The conclusion I am making out of this post is thatI should rather spend time resarching/reading about NUnit thanTSQLUnit. Is that a good assessment?I would like to you what you use and if you use actuallyUnit Testing or some other method? I ran into White Box/Black BoxQA testing. All these are new to me. Any good place to read about"Extreme Programming"? I ran into one link that I saved it at work.That's one place i will read more.Any links, documentation or books you would suggest?I searched Amazon and I didn't find anything interestingregarding SQL Server and Stored Procedures.Thank you

View 1 Replies View Related

Unit Testing

Jun 20, 2005

Well was wondering this weekend. How do you do unit testing with SSIS? Is anyone trying it?

View 9 Replies View Related

Adding Columns With Different Time Unit

Oct 29, 2014

I have three different columns, hour(s), min(s), sec(s)

I can add it up, but will like to convert it into. hrs, mins and sec.

this is how, i am adding it up into seconds.

SELECT ((TotalTimeSpentHrs*60*60)+(TotalTimeSpentMin*60)+(TotalTimeSpentSec))AS totaltime
FROM EST1

How can I convert the total seconds, so that i can input the result in a new column.

View 1 Replies View Related

Custom Component And Unit Testing

Nov 11, 2007



Hello.


I want to test my custom component with unit tests and i thought i must only initilize the component to play around with it. But when i calling the ProviderComponentProperties method and there the RemoveAllInputsOutputsAndCustomProperties method a NullReference exception is thrown. After debugging the test i had seen that the ComponentMetaData of the component is null. Is there a way to initilize the ComponentMetaData?

The Code of the Component looks like this:




Code Block
[DtsPipelineComponent(
DisplayName = "TestSourceAdapter",
ComponentType = ComponentType.SourceAdapter,
IconResource = "TestSourceAdapter.TestSourceAdapter.ico"
)]
public class TestSourceAdapter: PipelineComponent
{

public override void ProvideComponentProperties()
{

RemoveAllInputsOutputsAndCustomProperties();

IDTSOutput90 output = ComponentMetaData.OutputCollection.New();
output.Name = "TestSourceAdapter";


ComponentMetaData.OutputCollection

["TestSourceAdapter"].ExternalMetadataColumnCollection.IsUsed = true;

ComponentMetaData.ValidateExternalMetadata = false;
ComponentMetaData.UsesDispositions = true;
ComponentMetaData.Name = "TestSourceAdapter";
ComponentMetaData.Description = "TestSourceAdapter";


ReinitializeMetaData();
}


...
}




And in test i call only this




Code Block
TestSourceAdapter testAdapter = new TestSourceAdapter();
_testAdapter.ProvideComponentProperties();





i hope anyone can help

regards
kai

View 1 Replies View Related

File Allocation Unit Size

Mar 20, 2007

This is a question that has always intrigued me: what is the ideal File Allocation Unit Size for a disk holding only data or index pages on a server running SQL Server? It seems to me that 8,192 would be the ideal size as it would enable the system to gobble up an entire page in one go. Any ideas?

View 18 Replies View Related

Time Format - What's The Smallest Unit SQL 2005 Can Take?

May 2, 2007

saw my AS400 has this time stamp: 2007-05-02-11.29.56.811195

is SQL2005 able to have time stamp to this details?

View 1 Replies View Related

Breakout Records Based On UNIT Total Without Cursor

Jan 30, 2008

I have a set of revenue records where there is a UNIT column and a REVCHARGE column. What I need to do is breakout the records into single records where the unit count is > 1 and calc the actual charge:

Ex:

Units REVCHG FIELD_A FIELD_B .....
3 3.00 ABCD EFGH

Needs to be converted to:

Units REVCHG FIELD_A FIELD_B .....
1 1.00 ABCD EFGH
1 1.00 ABCD EFGH
1 1.00 ABCD EFGH

The calc is obvious but how can I do this with a cursor but would like to do it without a cursor if possible? Anybody got an idea?

Thanks.

View 6 Replies View Related

How To Find OrderID And Maximum-price Unit Of Each Order

Jun 13, 2013

How to select the orderID, order date and the maximum-price unit of each order in the below tables in 2 ways:

1-using correlated sub-query
2-not using correlated sub-query

I only selected orderID, order date and the maximum price of each order but not the unit name.This is my query:

Code:
SELECT dbo.[Order Details].OrderID, Max(dbo.[Order Details].UnitPrice)as MaxUnitprice, dbo.Orders.OrderDate
FROM dbo.[Order Details] INNER JOIN
dbo.Products ON dbo.[Order Details].ProductID = dbo.Products.ProductID INNER JOIN
dbo.Orders ON dbo.[Order Details].OrderID = dbo.Orders.OrderID
GROUP BY dbo.[Order Details].OrderID, dbo.Orders.OrderDate

View 6 Replies View Related

What Are To Be Installed At The Production Unit To Deploy A Package Created ?

Nov 14, 2006

Hi friends,

Can anybody tell what all are required for the deployment of a package.

I read from some article that to deploy ur package SSIS runtime and .Net framework should be installed first

and 1)it is not necessary to install sql server 2005. if so Is it True .?

2)whether the ssis runtime is freely available as independent installation package like .Net framework





View 5 Replies View Related

How To Write .net Code To Place XML Messages On Queues And Retrieve XML Messages From Queues.

Apr 2, 2008

Hello, please help!!

I have spent days searching the web and forums for an answer to this simple question and cannot find an example.

I have built a service broker application on sql server 2005. The application puts some xml on an incoming queue which is basically a few parameters to be used in a query. This queue will then call a stored proc which does some business logic and puts the resulting results in another queue also in xml.

I have written a test harness in SQL to put messages on the inbound queue and then some sql to retrieve the returned code from the outbound queue.

What I want to do is be able to convert the SQL which does this into .net code to be used by an application. i.e. write in .net some code to put xml on a queue and then write some .net code to retrieve xml from another queue.

I wouldn't have thought this would be a difficult thing to do and would have been done hundreds of times, but unable to find anything to simply send and retrieve XML to service broker queues....

thanks for your help.. its really needed. I found some links, but they are really vague and often doing select statments in service broker or something like this. I don't want to call any sql, just send and recieve XML on the queues.

any example code that does this, would be really helpfull

kind regards,
David Weeden
Database Developer

View 2 Replies View Related

Clearing A Table?

Jun 28, 2006

Hello, and sorry if this is really obvious.
Is there a way to wipe all data from a table, besides the obvious manual way?

View 1 Replies View Related

Clearing Tempdb

Oct 7, 1999

We have a production sql server V6.5 sp5a (running on NT 4.0 sp3) that has a tempdb that is fulling up about every two weeks. (The log to tempdb is okay, it is not filling up). Tempdb is defined as 400 MB. I have been reading about "The two most common db errors"; 1) The db log ran out of space and 2) The db ran out of space. We are receiving "The db ran out of space." Once tempdb gets near full is there anyway to clear tempdb without rebooting the nt server? Is there a stored procedure that can be scheduled to free up tempdb?

My books tell me the tempdb is used for creating temporary tables or storing temporary information. For example, a temporary table in a stored procedure or sql may create a temporary work table as a result of a query with a 'group by' or 'order by' clause. If these tables are temporary why don't sql release them or free up the space used by tempdb?

Thanks in advance!

View 1 Replies View Related

Transaction Log Not Clearing

Jul 5, 1999

We have a SQL Server 6.5 with SP5a installed and are having problems with the Transaction log not clearing every night when a scheduled backup takes place.
Is there anyway to debug this?

The Scheduled task that is run is
"DUMP DATABASE DBSALES TO DBSALESBK with INIT
DUMP TRANSACTION DBSALES WITH TRUNCATE_ONLY
DUMP DATABASE DISTRIBUTION TO DSBK WITH INIT
DUMP TRANSACTION DISTRIBUTION WITH TRUNCATE_ONLY"

I have also run on it DBCC Checktable(Syslogs) but it all seems fine. Any help would be appreciated.

View 3 Replies View Related

Log File Not Clearing

Oct 5, 1998

When I truncate the transaction log the log space available does not change?

View 2 Replies View Related

Database Clearing?

May 9, 2008

Hello!

I'd like to ask you what means the term "database clearing", if such a concept exists in the Database Theory.
Maybe this is not directly related to SQL Server but any help would be very appreciated. So please anybody who have an idea of what this could mean is welcome to reply here

Thank you very much in advance.
With best regards,
Sorin

View 9 Replies View Related

Clearing A Table

Apr 8, 2007

I have entered some temporary values in a table located in an SQL database, to test a project to see if it was working. Now I want to remove the values so that later, the program I have created will be capable of using the table for it's true purpose. However, when I try to delete the values located there, I receive an error message. How can I clear the table?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved