use [msdb]
declare @objectname varchar(100)
set @objectname=your object name here
select j.[name] as jobname,c.[name],js.*
from dbo.sysjobs j
inner join dbo.sysjobsteps js
on js.job_id = j.job_id
inner join dbo.syscategories c
on c.category_id = j.category_id
where js.command like '% ' + @objectname + ' %'
notice the spaces along with % character. This is required for whole word matching else it will also return cases where it can find @objectname patterns within job step.
Similarly if you want to search for jobs which uses a particular SSIS package you just to need to remove spaces near %. this is because the command for ssis packages will come in pattern like that shown in 5 th point in below link
No comments:
Post a Comment