SQL Query - To stop/kill long running SQL job

I have a sql job who does some calculation in every 15 minutes.

Now i want to monitor this job. To check if that job is currently running and if yes then its been running for more than 10 minutes.

If it's running for more than 10 minutes then i want to stop/kill this job.

Is there any query available to do it?


My best guess is you need SMO (SQL Server Management Objects) to pull this off. In particular take a look at the Job Class.


EXEC msdb.dbo.sp_stop_job N'job name'

And it worked!

Need Your Help

Calculating an area under a continuous density plot

r ggplot2 area curve

I have two density curves plotted using this:

How to avoid "Sorry, my bot code is having an issue" in Microsoft Bot Framework

c# botframework luis

I have a bot that runs on Azure + Bot Framework + LUIS (via LuisDialog).