SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,676 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
HI Team,
Is their any option to get the SQL jobs list along with SQL scripts which is used in job.
Please help on same.
USE [msdb];
GO
SELECT
j.[name] AS [Job Name],
s.[step_name] AS [Step_Name],
s.[database_name] AS [Database Name],
s.[command] AS [SQL Script]
FROM [dbo].[sysjobs] AS j
INNER JOIN [dbo].[sysjobsteps] AS s ON j.[job_id] = s.[job_id]
WHERE j.[enabled] = 1
AND s.[subsystem] = 'TSQL'
ORDER BY j.[name], s.[step_id];