Executing a query from client app. How to ensure completion if app closed?

  • Hi I have a problem that I hope somebody can help with.

    I have a client app coded in c# and running against a SQL 2005 database. On the db is a stored procedure that can run for several hours. I need to start the sproc running from a client application.

    The problem is that if the user closes the app, then the query will be aborted. Is there a way to do this so that the app can be closed and the query will still run?

    This cannot be run as a scheduled job. So I am hoping somebody may have an alternative method.

    Many thanks

  • Wouldn't it be better to run it asynchronously?. You don't have to schedule execution, but if you create a job that executes this sproc and call msdb..sp_start_job from you client app you will not be dependant on network connection, client workstation failures, app stability and user behavior.

    Well, for me these are advantages 🙂

    Piotr

    ...and your only reply is slàinte mhath

  • Thanks for your reply Piotr.

    I was thinking along that avenue, its just that the client has a policy of not using SQL Agent. They run all there scheduled jobs from autosys. I'll see if they can make an exception in my case as the job will be user activated in the manner that you mentioned.

  • Honestly this sounds like a perfect place for Service Broker. Send a message to a Q from the app, the message will route and kick off the proc/query. Then have that proc send a message back at the end. The client can run things whenever it wants and check for a completion message.

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

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