Thank this author by sharing:
By Adnan Korkmaz, 2012/10/10
Some background: I am not a DBA and it's my first contribution here. Sorry for any typos / errors if any in advance. I develop an application which runs on several SQL servers where I have many jobs with different schedules on each server. To be able to monitor all these servers at once, I wrote an Asp page which executes this script and summarizes the results.
Installation: You can create the script in whatever database you like, while I preferred master.
Parameters: (All parameters are optional)
Output Columns:
Samples:
Default usage lists all enabled jobs with a schedule:
You can filter to see only one job at a time:
List all jobs:
List all jobs, whose last execution time is above 1 minute:
List all jobs, whose average execution time is above 1 hour:
Last executed query total duration
Every time Store procedure take different duration to exeucte
Duration
SQL 2005 - Long duration Stored Procedure
SQL Agent stores duration in HHMMSS format - not always useful. Discover how to use Powershell, some...
As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.
Join us!
Steve Jones Editor, SQLServerCentral.com