Skip to content

Instantly share code, notes, and snippets.

@royashbrook
Created February 7, 2018 18:45
Show Gist options
  • Save royashbrook/4a9ca0164f01b040780d38f65c7a280f to your computer and use it in GitHub Desktop.
Save royashbrook/4a9ca0164f01b040780d38f65c7a280f to your computer and use it in GitHub Desktop.
-- search the jobs for a specific text
select
[InstanceName] = serverproperty('servername')
, j.job_id
, j.name
, js.step_id
, js.command
, j.enabled
from
msdb.dbo.sysjobs j
join msdb.dbo.sysjobsteps js on
js.job_id = j.job_id
where
js.command LIKE '%sometext%' -- replace keyword with the word or stored proc that you are searching for
-- search the sql code
select
routine_name
, routine_definition
, routine_type
from
information_schema.routines
where
routine_definition like '%sometext%'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment