x
login about faq Site discussion (meta-askssc)

Reading multiple lines from the queue in service broker in SQL server

I am using the following command to read from the queue. But it returns only one row. I noticed that conversation_handle is unique for all messages. How can I read top 100 or all the rows from the queue in sql server?

RECEIVE *-- @handle=conversation_handle, --@xml=CAST(message_body AS XML) FROM EventData_Destination_Queue

more ▼

asked Aug 31 '12 at 05:02 PM in Default

pratpk9 gravatar image

pratpk9
0 1 2

(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

Have you tried:

RECEIVE TOP 100 (*)
FROM EventData_Destination_Queue

Of course this may clear your queue and processing of messages wouldn't be possible.

I imagine in your example only the last message in the queue is displayed. The variables don't hold rowsets, just single values from a given row.

more ▼

answered Aug 31 '12 at 06:56 PM

Blackhawk-17 gravatar image

Blackhawk-17
10.5k 23 29 34

(comments are locked)
10|1200 characters needed characters left

Greg-- Thanks for your response. Yes I have tried it as well. But still I receive only one row from the query. This is the query I used

RECEIVE * FROM EventData_Destination_Queue

more ▼

answered Aug 31 '12 at 09:44 PM

pratpk9 gravatar image

pratpk9
0 1 2

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x54

asked: Aug 31 '12 at 05:02 PM

Seen: 281 times

Last Updated: Aug 31 '12 at 09:44 PM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.