How to write and read data into queue from Trigger

Sudip Bhatt 2,271 Reputation points
2020-10-31T07:55:06.027+00:00

I have plan to store newly inserted / updated data into queue from trigger. so please tell me how could i store inserted / updated data into queue from trigger. a small example of code will help.

How to read data from sql server queue from c# console application. basically ?

How to show data stored in queue from SSMS?

Thanks

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,558 questions
{count} votes

Accepted answer
  1. Erland Sommarskog 101.8K Reputation points MVP
    2020-10-31T21:18:40.46+00:00

    To be able to send a command on a Service Broker queue, you first need to start a dialog with BEGIN DIALOG. Although in most cases you would work with pooled connections, and get a pooled conversation handle from a table, if it is available. Once you have the handle, you use the SEND command to send the message. On the other end you use the RECEIVE command.

    This forum is good for short and simple questions, but it is not a good venue to learn features from scratch. You have had threads in the past where I and others have suggested reading material about Service Broker, and I suggest that you revisit those threads.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Sudip Bhatt 2,271 Reputation points
    2020-10-31T21:04:33.957+00:00

    Sir i want to store data into service broker queue from trigger. How it will be possible?

    How to store data into queue from table and how to read data from queue?

    Thanks

    0 comments No comments