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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mufasa

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

    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.


  • Chris Jobson

    #2
    Re: Submitting a stored proc to run but not wait for it with MS SQL

    "Mufasa" <jb@nowhere.com wrote in message
    news:eKaI$Mu0IH A.548@TK2MSFTNG P06.phx.gbl...
    >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


    Comment

    • =?ISO-8859-1?Q?Arne_Vajh=F8j?=

      #3
      Re: Submitting a stored proc to run but not wait for it with MS SQL

      Mufasa wrote:
      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

      Comment

      Working...