how to use osql command to stop a running job

  • We have an MSDE instance, I have an osql job script created that runs database backups. I kicked off the job but would like to cancel it. Is there an osql command to do this? Thanks for any ideas.

  • Run sp_who to get the spid of the job.  Then run kill spid

    Take care,

    Bert

    "Speculations? I know nothing about speculations. I'm resting on certainties. I know that my Redeemer lives, and because He lives, I shall live also." - Michael Faraday

  • Not sure if I would feel comfortable to kill a process on a regular basis. I know it's not as dangerous as back in the 6.5 days. I learned the very hard way to not kill processes in 6.5.

    When you stop a job in SQL Agent, does it kill the process or just try and cancel it? There's got to be a better way than killing the process.


    Live to Throw
    Throw to Live
    Will Summers

  • Either way will keep your database in a consistent state (i.e. roll back the transaction).

     

    I forgot to mention, you've got the option to use sp_stop_job.

    Take care,

    Bert

    "Speculations? I know nothing about speculations. I'm resting on certainties. I know that my Redeemer lives, and because He lives, I shall live also." - Michael Faraday

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

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