Running a stored proc that will take a while.

M

Mr. Magic

Is there a way to asynchronously run a Stored Proc from C#/ASP.Net ? I have
a stored proc that is going to take 5 minutes or so to run and don't want
the user to have to sit and wait for it. I will handle the error handling
elsewhere so all I have to do is submit the stored proc and then I'll worry
about the rest of the stuff.

TIA - Jeff.
 
G

Gregory A. Beamer

Is there a way to asynchronously run a Stored Proc from C#/ASP.Net ? I
have a stored proc that is going to take 5 minutes or so to run and
don't want the user to have to sit and wait for it. I will handle the
error handling elsewhere so all I have to do is submit the stored proc
and then I'll worry about the rest of the stuff.

More than one:

Mr. Arnold has already suggested an asynch "web service" (in quotes, as
you can set this up with WCF without using the HTTP stack, so it is not
truly "web").

You can also spin up a thread and run the sproc from there. If it
returns a result set, you will need an event handler to handle the end
event and inform the user their data is ready.

If the sproc in question returns a report, you can also consider
Reporting Services and queue up the report. When done, you can send
notification and you can also cache the results if the report is viewed
by numerous people.

I can think of a few others, but these are fairly common.

Peace and Grace,
Greg

--
Vote for Miranda's Christmas Story
http://tinyurl.com/mirandabelieve

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
G

Gregory A. Beamer

Also, if the OP is using SQL Server 2005 or higher, he could use SQL
Server Broker, sending a message to a queue to run the sporc that
would be ran async.

The OP can also use an async Windows Workflow to queue the sproc and
run it.

I love Service Broker. :)

I had thought about mentioning that, as well, but figured it was probably
overkill for the OP's process.

Peace and Grace,

--
Gregory A. Beamer (MVP)

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top