Is there any way to search and find ,what job holds a particular table refresh . There are multiple sql agent jobs with multiple steps.What is the sql query to search all jobs and locate the job name and steps?
This is to identify the steps associated with a table load
To view job step information In Object Explorer, connect to an instance of the Microsoft SQL Server Database Engine, and then expand that instance.
You can use msdb. dbo. sysjobs to translate the job_id to a job_name.
Using SQL Server Management StudioIn Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance. Expand SQL Server Agent, and then expand Jobs. Right-click a job, and then click Properties.
Using SQL Server Management StudioIn Object Explorer, expand Databases, expand a database, and then expand Tables. Right-click a table, and then click View Dependencies.
Take a look at this:
Querying SQL Agent Jobs
use msdb
SELECT
[sJOB].[job_id] AS [JobID]
, [sJOB].[name] AS [JobName]
,step.step_name
,step.command
FROM
[msdb].[dbo].[sysjobs] AS [sJOB]
LEFT JOIN [msdb].dbo.sysjobsteps step ON sJOB.job_id = step.job_id
WHERE step.command LIKE '%MYTABLENAME%'
ORDER BY [JobName]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With