Listar todos los Jobs de SQL Server junto a la cantidad de Steps que cada uno posee.


Consulta rápida para obtener esta información.

SELECT DISTINCT substring(a.name,1,100) AS [Job Name],
	COUNT(t.step_id) AS Steps, 
	'Enabled'=case 
	WHEN a.enabled = 0 THEN 'No'
	WHEN a.enabled = 1 THEN 'Yes'
	end, 
    	substring(b.name,1,30) AS [Name of the schedule],
	'Frequency of the schedule execution'=case
	WHEN b.freq_type = 1 THEN 'Once'
	WHEN b.freq_type = 4 THEN 'Daily'
	WHEN b.freq_type = 8 THEN 'Weekly'
	WHEN b.freq_type = 16 THEN 'Monthly'
	WHEN b.freq_type = 32 THEN 'Monthly relative'	
	WHEN b.freq_type = 32 THEN 'Execute when SQL Server Agent starts'
	END,	
	'Units for the freq_subday_interval'=case
	WHEN b.freq_subday_type = 1 THEN 'At the specified time' 
	WHEN b.freq_subday_type = 2 THEN 'Seconds' 
	WHEN b.freq_subday_type = 4 THEN 'Minutes' 
	WHEN b.freq_subday_type = 8 THEN 'Hours' 
	END
FROM  msdb.dbo.sysjobs a 
INNER JOIN msdb.dbo.sysJobschedules c ON a.job_id = c.job_id 
INNER JOIN msdb.dbo.SysSchedules b on b.Schedule_id=c.Schedule_id
INNER JOIN msdb.dbo.sysjobsteps t on a.job_id=t.job_id
GROUP BY substring(a.name,1,100), a.enabled, substring(b.name,1,30), b.freq_type, b.freq_subday_type