Submitting a stored proc to run but not wait for it with MS SQL

M

Mufasa

I have a stored proc that take a while to run (over 5 minutes) and I want to
have a program that would allow somebody to submit it. If it comes back with
errors, I don't care - they get saved someplace. Is there some way I can
execute a stored proc but have it 'submitted' and return immediately?

I also have this as a job in SQL Agent but it only runs once a night. If I
needed to I could in theory submit the job to run immediately.

TIA - Jeff.
 
C

Chris Jobson

Mufasa said:
I have a stored proc that take a while to run (over 5 minutes) and I want
to have a program that would allow somebody to submit it. If it comes back
with errors, I don't care - they get saved someplace. Is there some way I
can execute a stored proc but have it 'submitted' and return immediately?

This link http://msdn.microsoft.com/en-us/library/zw97wx20.aspx
(Asynchronous Operations in ADO.NET) might give you a start.

Chris Jobson
 
A

Arne Vajhøj

Mufasa said:
I have a stored proc that take a while to run (over 5 minutes) and I want to
have a program that would allow somebody to submit it. If it comes back with
errors, I don't care - they get saved someplace. Is there some way I can
execute a stored proc but have it 'submitted' and return immediately?

I also have this as a job in SQL Agent but it only runs once a night. If I
needed to I could in theory submit the job to run immediately.

Will the calling code continue to run (just doing something
else) or will it terminate ?

Continue => some kind of thread running in the background
of your app.

Terminate => you need to have the SP executed
somewhere else like a Windows service running
in the background.

Arne
 

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