x

Insert data into a queue

I am trying to insert data into queue. The stored procedure fire_event will be used for this purpose. When ever this stored procedure is called, it should insert that data into the queue.. Below is the query and variables that will be passed from the stored procedure. Can some one tell me how to use this stored procedure to insert data in a queue in SQL Server. I want to replace the action of inserting into a table event_type by inserting it directly into a queue. Thanks

BEGIN

INSERT event_type
VALUES (@p_message_id,@p_event_type,@p_classifier,
        @p_event_time,@p_correlation_id,@p_person_id,@p_channel_id,
        @p_source_address_id,@p_agent_user,
        @p_agent_channel_id,@p_device_os,@p_device_os_version,
        @p_device_manufacturer,@p_device_model,@p_product_id,
        @p_event_source,@p_event_version,
        @p_node_id,@p_user_agent_string,@p_event_data)

END 
more ▼

asked Aug 31, 2012 at 10:54 PM in Default

pratpk9 gravatar image

pratpk9
0 2 2 2

Can you elaborate more on the business scenario?
Sep 20, 2012 at 03:12 PM jjaroska
(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first
DECLARE 
 @h UNIQUEIDENTIFIER
 ,@msg XML = 
 (
 SELECT

 @p_message_id
 ,@p_event_type
 ,@p_classifier
 ,@p_event_time
 ,@p_correlation_id
 ,@p_person_id
 ,@p_channel_id
 ,@p_source_address_id
 ,@p_agent_user
 ,@p_agent_channel_id
 ,@p_device_os
 ,@p_device_os_version
 ,@p_device_manufacturer
 ,@p_device_model
 ,@p_product_id
 ,@p_event_source
 ,@p_event_version
 ,@p_node_id
 ,@p_user_agent_string
 ,@p_event_data
 FOR XML PATH('record')
 )

BEGIN DIALOG CONVERSATION @h
    FROM SERVICE [fromService]
    TO SERVICE 'toService'
    ON CONTRACT myContract
    WITH ENCRYPTION = OFF
more ▼

answered Dec 20, 2012 at 08:20 PM

JakeE gravatar image

JakeE
0

(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.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

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

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x55
x14

asked: Aug 31, 2012 at 10:54 PM

Seen: 1059 times

Last Updated: Dec 23, 2012 at 02:56 AM