DOWNLOAD THE CODE:
Download the Code 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.

End of Article




Post Your Comments Here

You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now

Reader Comments

I've been looking for something like this for a while. Awesome!

jloranger

Article Rating 5 out of 5

Good stuff

rhochambeau

Article Rating 4 out of 5

Be nice to associate owner and DB with this info. :)

pete.adams

Article Rating 5 out of 5

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.

bvnashok

Article Rating 3 out of 5

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.

datagod

Article Rating 5 out of 5

Also see http://weblogs.sqlteam.com/peterl/archive/2008/10/10/Keep-track-of-all-your-jobs-schedules.aspx

stroede

Article Rating 3 out of 5

 
 

ADS BY GOOGLE