omkar patade omkar patade - 2 years ago 98
SQL Question

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?

Answer Source


EXEC msdb.dbo.sp_stop_job N'job name'

And it worked!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download