How to find all SQL Agent Jobs that call a given stored-proc

前端 未结 3 1878
春和景丽
春和景丽 2020-12-28 15:49

I\'m in SQL 2008/R2. I want to run a query to see if there is a SQL Agent job calling a specified stored proc (there are too many to inspect manually).

3条回答
  •  执笔经年
    2020-12-28 16:36

    You can use this query -

    SELECT s.step_id,
           j.[name],
           s.database_name,
           s.command
    FROM   msdb.dbo.sysjobsteps AS s
    INNER JOIN msdb.dbo.sysjobs AS j ON  s.job_id = j.job_id
    WHERE  s.command LIKE '%Stored_procedure%'
    

提交回复
热议问题