Was this page helpful?
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

SEND (Transact-SQL)

Sends a message by using an existing conversation.

   ON CONVERSATION conversation_handle
   [ MESSAGE TYPE message_type_name ]
   [ ( message_body_expression ) ]
[ ; ]

ON CONVERSATION conversation_handle

Specifies the conversation that the message belongs to. The conversation_handle must contain a valid conversation identifier.

MESSAGE TYPE message_type_name

Specifies the message type of the sent message. This message type must be included in the service contract used by this conversation. The contract must allow the message type to be sent from this side of the conversation. For example, the target of the conversation can only send messages specified in the contract as SENT BY TARGET or SENT BY ANY. If this clause is omitted, the message is of the message type DEFAULT.


Provides an expression representing the message body. The message_body_expression is optional. However, if the message_body_expression is present the expression must be of a type that can be converted to varbinary(max). The expression cannot be NULL. If this clause is omitted, the message body is empty.

If the SEND statement is not the first statement in a batch or stored procedure, the preceding statement must be terminated with a semicolon (;), the Transact-SQL statement terminator.

The SEND statement locks the conversation group that the specified conversation handle belongs to.

SEND is not valid in a user-defined function.

To send a message, the current user must have SEND permission on the service that the dialog is from. If a remote service binding for the service exists, the user specified in that remote service binding must have RECEIVE permissions on the queue for the service that the dialog is from.

A. Sending a message

This example starts a dialog and sends an XML message on the dialog. To send the message, the example converts the xml object to varbinary(MAX).

        @ExpenseReport XML ;

SET @ExpenseReport = < construct message as appropriate for the application > ;

BEGIN DIALOG @dialog_handle
FROM SERVICE [//Adventure-Works.com/Expenses/ExpenseClient]
TO SERVICE '//Adventure-Works.com/Expenses'
ON CONTRACT [//Adventure-Works.com/Expenses/ExpenseProcessing] ;

    MESSAGE TYPE [//Adventure-Works.com/Expenses/SubmitExpense]
    (@ExpenseReport) ;
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft