Comments on: HOW TO: Find Currently Running Long SQL Agent Jobs https://thomaslarock.com/2014/08/find-currently-running-long-sql-agent-jobs/ Thomas LaRock is an author, speaker, data expert, and SQLRockstar. He helps people connect, learn, and share. Along the way he solves data problems, too. Fri, 12 May 2017 20:29:22 +0000 hourly 1 https://wordpress.org/?v=6.7.2 By: ThomasLaRock https://thomaslarock.com/2014/08/find-currently-running-long-sql-agent-jobs/#comment-13608 Fri, 11 Mar 2016 15:08:00 +0000 http://thomaslarock.com/?p=11664#comment-13608 In reply to JustMike.

Oh, that’s interesting! I wonder why certain job steps are excluded? Now I need to go dig around to find out!

]]>
By: JustMike https://thomaslarock.com/2014/08/find-currently-running-long-sql-agent-jobs/#comment-13604 Thu, 03 Mar 2016 21:06:00 +0000 http://thomaslarock.com/?p=11664#comment-13604 Tom – Thanks for putting this together. I had written something similar ages ago, but it only considered jobs running a step type that shows up in sysprocesses. Come to find out that the code doesn’t catch job steps that run Powershell (for example).

]]>
By: Thomas LaRock https://thomaslarock.com/2014/08/find-currently-running-long-sql-agent-jobs/#comment-12392 Thu, 30 Oct 2014 18:06:35 +0000 http://thomaslarock.com/?p=11664#comment-12392 In reply to Andrew G.

Andrew,

Thanks! It would appear that when I tested this code I did have jobs with longer duration, and therefore my result set came back. When I just tried it without that clause, as you suggested, it worked fine. So, I’m removing it, and I updated the comments as you suggested.

Thanks again for the comment! Much appreciated!

Tom

]]>
By: Andrew G https://thomaslarock.com/2014/08/find-currently-running-long-sql-agent-jobs/#comment-12312 Wed, 29 Oct 2014 08:15:22 +0000 http://thomaslarock.com/?p=11664#comment-12312 I think you need to remove the line:
WHERE secs_duration > AvgPlus2StDev

If you leave it in, then the secs_duration from the job history table will need to exist – ie. there will need to be at least one historical record of the job running longer than average+2 standard deviations. So if a job is currently running longer than usual, you wont find out until next time it’s running. It works fine with the other WHERE condition.

Also you need to update the date in the comments section to August 2014 rather than 2012.

]]>
By: (SFTW) SQL Server Links 22/08/14 - John Sansom https://thomaslarock.com/2014/08/find-currently-running-long-sql-agent-jobs/#comment-11608 Fri, 22 Aug 2014 07:45:31 +0000 http://thomaslarock.com/?p=11664#comment-11608 […] How To: Find Currently Running Long SQL Agent Jobs – Thomas Larock (Blog|Twitter) […]

]]>
By: HOW TO: Find Currently Running Long SQL Agent Jobs - SQL Server - SQL Server - Toad World https://thomaslarock.com/2014/08/find-currently-running-long-sql-agent-jobs/#comment-11601 Tue, 19 Aug 2014 02:22:18 +0000 http://thomaslarock.com/?p=11664#comment-11601 […] HOW TO: Find Currently Running Long SQL Agent Jobs is a post from: SQLRockstar – Thomas LaRock […]

]]>