How to query cross-database in Service Broker activated Stored Procedure

  • My service broker dialog initiates a stored procedure. In this stored procedure I want to call a function in another database using dbname.dbo.functionname. This does not work in the sp initiated by service broker. It only works if the function is in the same database as the sp and I call it by dbo.functionname.

    Can anyone give me some pointers as to what settings/tricks I need to employ to get this cross-database function call to work? Or is it just not possible, and I need to have all functions in the same database (perish the thought).

    Many thanks.

  • Most probably the following link will help you to resolve that problem:

    http://rusanu.com/2006/03/07/call-a-procedure-in-another-database-from-an-activated-procedure/



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • lmu92,

    Thank you for sending that link to rusanu.com for this sample piece. I am new to service broker and it seems like there is a disconnect as to what I should do if I receive a message besides sending acknowledgment that I could receive per msdn example.

    --sopheap

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

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