T-SQL query to check SQL server agent status
MSSQL, T-SQL Scripts SQL Agent, SQL server 0
(0)
IF EXISTS(
SELECT 1 FROM MASTER.dbo.sysprocesses WHERE LEFT(program_name,8)= 'SQLAgent')
BEGIN
SELECT SERVERPROPERTY('ServerName') AS 'InstanceName',getdate() AS CurrentDate, 'Running' AS 'SQLServerAgent Status'
END
ELSE
BEGIN
SELECT SERVERPROPERTY('ServerName') AS 'InstanceName',getdate() AS CurrentDate, 'Stopped' AS 'SQLServerAgent Status'
END
Sample Output:

How useful was this post?
Click on a star to rate it!
Average rating 0 / 5. Vote count: 0
No votes so far! Be the first to rate this post.