Recently we need to look for a procedure where we are using in SQL Jobs. There is no easy way to find unless you script all jobs and find in the script.
But there is some easy way to find it using below query. You could also might have similar ask to find a procedure or table that you might have used in SQL Jobs in any of those steps. It could be any string like comment, procedure, function or table, this below query works.
USE msdb GO SELECT [sJOB].[job_id] AS [JobID] ,[sJOB].[name] AS [JobName] ,step.step_name AS JobStepName ,step.command AS JobCommand ,[sJOB].enabled AS ActiveStatus FROM [msdb].[dbo].[sysjobs] AS [sJOB] LEFT JOIN [msdb].dbo.sysjobsteps step ON sJOB.job_id = step.job_id WHERE step.command LIKE '%uspPopulateAggregatorUsageData%' ----You can change here what you are searching for ORDER BY [JobName]
Thank you
No comments:
Post a Comment