Search Text in Steps of SQL Server Agent Jobs
In certain circumstances, we might want to look for SQL Server Agent Jobs.
· Find SQL Agent Job if it is using some specific Stored procedure in Job Step Command.
· Look for Comments in the queries we used in the SQL Server Agent jobs Steps.
· Look for Comments in the queries we used in the SQL Server Agent jobs Steps.
If the text is used in the SQL Server
Agent Job, we will look for it in two system tables. There are two system
tables in the MSDB database, namely SysJobs and SysJobSteps.
In this example we are searching for
string if any job is using "Select count(*) from dbo.Test".
USE msdb
GO
SELECT Job.name AS JobName,
Job.enabled AS ActiveStatus,
JobStep.step_name AS JobStepName,
JobStep.command AS JobCommand
FROM sysjobs Job
INNER JOIN sysjobsteps JobStep
ON Job.job_id = JobStep.job_id
WHERE JobStep.command LIKE '%Select count(*) from
dbo.Test%'
--You can change here
what you are searching for
0 Comments