Stored Procedure Documents Scheduled Jobs in SQL Server

Downloads
97793.zip

Executive Summary:

Microsoft SQL Server Management Studio (SSMS) is great at quickly creating jobs and schedules. However, it's not so great at generating a master list of those jobs. Using Microsoft SQL Server Management Studio to generate a master job list involves a lot of mouse-clicking and cutting and pasting. Fortunately, Bill McEvoy has come up with an alternative: a T-SQL stored procedure named sp_ShowJobSchedules, which runs on Microsoft SQL Server 2005.


If you’re a DBA who has just transferred to a new environment, you should familiarize yourself with the existing SQL Server scheduled jobs. Documenting those job schedules can be an arduous task, especially in a large production environment. Although you can use SQL Server Management Studio (SSMS) to quickly create jobs and schedules, generating a master list usually involves a lot of mouse-clicking followed by a lot of cutting and pasting.

The sp_ShowJobSchedules stored procedure changes all that. The sp_ShowJobSchedules stored procedure generates a master schedule for all jobs on the server. The report generated includes information such as the server name,the job name, the schedule name, whether or not the job is enabled, the frequency, and the interval. For readability, the information is provided in plain English where possible. Figure 3 shows some sample output that has been condensed for space purposes.

I wrote sp_ShowJobSchedules for SQL Server 2005. You can download this store procedure by going to www.sqlmag.com, entering 97793 in the InstantDoc ID text box, then clicking the 97793.zip hotlink. I use sp_Show- JobSchedules all the time. I hope you will, too.

Discuss this Article 6

John (not verified)
on Feb 13, 2008
Good stuff
Justin (not verified)
on Feb 1, 2008
I've been looking for something like this for a while. Awesome!
datagod
on Mar 4, 2008
Bvnashok, This stored procedure has been tested on a variety of SQL Server installations and has been running without error for years (the original code was developed in 2002 for SQL 2000). Can you please provide some details with regards to your exact version of SQL Server, whether or not it is a named instance, etc. Also, can you please enumerate the jobs that are running along with details of their schedules? My guess is that you have a job defined with a non-standard schedule that is causing the problem to present itself.
stroede
on Nov 19, 2008
Also see http://weblogs.sqlteam.com/peterl/archive/2008/10/10/Keep-track-of-all-your-jobs-schedules.aspx
bvnashok
on Mar 4, 2008
Hi, The script is useful, but it is not working in all conditions. I am getting the following error: Msg 512, Level 16, State 1, Procedure sp_ShowJobSchedules, Line 13 Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. It would be nice, if the scripts are completed tested and then post to public.
fajitapete
on Feb 15, 2008
Be nice to associate owner and DB with this info. :)

Please or Register to post comments.

IT/Dev Connections

Las Vegas
September 30th - October 4th

Paul ThurottOur Experts will show you:
• Common SQL Server
Problems
• Best Practices for T-SQL
• SQL Server Integration
Services
• Database Development

Come See Michael Otey & Tim Ford in Person!

Early Registration Now Open

From the Blogs
May 21, 2013
blog

A Common Misconception about MAXDOP

Out of the box, SQL Server is (and has been) able to take advantage of multiple processors/cores without any effort on behalf of administrators....More
May 9, 2013
blog

My ISO 8601-Compliant Signature 2

My family recently just "officially" announced that we're in the process of adopting a child from South Africa. We're quite excited, of course, but there's a ton of paperwork to do—along with the need for gobs of signatures....More
May 8, 2013
blog

Use SSIS for ETL from Hadoop

In this blog post, Mark Kromer walks you through using SSIS as a way to use ETL techniques using Microsoft's Hadoop on Windows (HDInsight) as a source using Hive connectors...More
SQL Server Pro Forums

Get answers to questions, share tips, and engage with the SQL Server community in our Forums.