how to check whether a message is following

  • Hi All,

    We are sending a message when an update or insert happens in a table.

    When an insert happens in a table the inserted data and the field names are send in xml format to another database in the form of a message using service broker. Once the message is received at the second database queue is activated by a stored procedure which produces a string having field names and the values in xml format.

    Now my question is when data is inserted into two tables in databaseA we will get two messages to databaseB and the stored procedure which activates the queue in the databaseB produces two strings. But the thing is I need to get those two strings combined at the end.

    Some times the data will be inserted into one table and some times the data will be inserted into two tables in database A

    So now how can I check whether there is any message following the first message produced by inserting data into table1 that is being currently used in the activation stored proc. Is there any code to check whether any message is coming from databaseA that I can use in the stored proc to combine this string with the message that is following this.

    Let me know if you need any additional information

    Thanks in advance.

  • Just do a second RECEIVE in the activation procedure.

    [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]

  • Hi,

    Thank you very much...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