Can we end a conversation on the target side without sending a response message?

  • Hi,

    Can we end a conversation on the target side without sending the response message back to the intiator?

    When i tried it it is giving me an error saying 'Incorrect syntax near the keyword 'COMMIT'.

    '

    Here is the code i've used:

    DECLARE @ConvHdl uniqueidentifier

    , @msg_body nvarchar(MAX)

    , @msg_type sysname

    -- Start a transaction

    BEGIN TRAN; -- Semicolon Mandatory -- ROLLBACK TRAN

    -- Receive the message from the queue

    RECEIVE top(1)

    @msg_type = message_type_name

    , @ConvHdl = conversation_handle -- handle of dialog

    , @msg_body = message_body -- Now that's what I call a message

    FROM [TitleTargetQueue]

    select @msg_type [msg_type], @ConvHdl [ConvHdl], @msg_body [msg_body]

    -- If this is a book Lookup message, respond with information about the book.

    -- Just return a standard response.

    --if @msg_type = N'http://schemas.novicksoftware.com/SBBook/TitleRequest' Begin

    --SEND ON CONVERSATION @ConvHdl -- respond on the same dialog

    --MESSAGE TYPE [http://schemas.novicksoftware.com/SBBook/TitleResponse]

    --(N'

    --Transact-SQL User Defined Fucntions

    -- Andrew Novick

    --')

    --END CONVERSATION @ConvHdl -- Done with Conversation

    END

    COMMIT TRAN

  • Thats because you've got an END statement without corresponding BEGIN in there:

    Try it like this:

    DECLARE @ConvHdl uniqueidentifier

    , @msg_body nvarchar(MAX)

    , @msg_type sysname

    -- Start a transaction

    BEGIN TRAN

    -- Receive the message from the queue

    ;RECEIVE top(1)

    @msg_type = message_type_name

    , @ConvHdl = conversation_handle -- handle of dialog

    , @msg_body = message_body -- Now that's what I call a message

    FROM [TitleTargetQueue]

    select @msg_type [msg_type], @ConvHdl [ConvHdl], @msg_body [msg_body]

    IF NOT (@ConvHdl IS NULL)

    END CONVERSATION @ConvHdl -- Done with Conversation

    COMMIT TRAN

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • Barry,

    Thanks a lot!! that worked out for me.

  • Glad I could help!

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply