SQL server Agent - Status

,

EXEC [KDT_SP_SYSTEM_HEATH_SQL_CHECK_SQL_AGENT]

IF EXISTS (SELECT 1 FROM SYSOBJECTS WHERE NAME ='KDT_SP_SYSTEM_HEATH_SQL_CHECK_SQL_AGENT')
BEGIN
  DROP PROCEDURE KDT_SP_SYSTEM_HEATH_SQL_CHECK_SQL_AGENT
END 
GO 

CREATE PROCEDURE [dbo].[KDT_SP_SYSTEM_HEATH_SQL_CHECK_SQL_AGENT]

AS 
BEGIN
/*

 created by KRAAI Du Toit TO CHECK IF SQL AGENT IS RUNNING 
 EG EXEC [KDT_SP_SYSTEM_HEATH_SQL_CHECK_SQL_AGENT]
 used in my webpage to see if the agnet is running 

 KraaiComedy.com
 Jfkproductions.co.za

 Joke of day : I joined the tables together ; so I can get a better View. Not a standard Procedure I know
           
*/
DECLARE @ACTIVE CHAR(1),
		@COLOR  VARCHAR(25)

	IF NOT EXISTS (SELECT 1 FROM master.dbo.sysprocesses WHERE program_name = N'SQLAgent - Generic Refresher')
	BEGIN
		SELECT @ACTIVE='N',@COLOR ='RED'
	END
	else 
	begin
		SELECT @ACTIVE='Y',@COLOR ='GREEN'
	end 
	select @ACTIVE AS ACTIVE ,@COLOR AS COLOR
END 

Go

Rate

Share

Share

Rate