SQL Server Performance

TSQL to disable all scheduled jobs

Discussion in 'Other SQL Server Blogs around the Web' started by Anonymous, Jun 11, 2009.

  1. Anonymous New Member

    Here is the TSQL script that I received from one of the enthusiastic SQL user Prabhakaran on our site: SET NOCOUNT ON DECLARE @job TABLE ( seq SMALLINT IDENTITY, jobname SYSNAME ) ; -- Declare Table variable to hold job info DECLARE @name SYSNAME, @seq SMALLINT ; INSERT @job SELECT name FROM msdb..sysjobs (NOLOCK) WHERE enabled = 1 -- You can put more condition here to disable the required jobs SELECT @seq = MAX(seq) FROM @job WHILE ( @seq &gt; 0 ) BEGIN SELECT @name = jobname FROM @job WHERE seq...(<a href="http://sqlserver-qa.net/blogs/t-sql/archive/2009/06/11/5757.aspx">read more</a>)<img src="http://sqlserver-qa.net/aggbug.aspx?PostID=5757" width="1" height="1">

Share This Page