There may be probability that we have hundreds of SQL Server’s Jobs scheduled to run every day on a SQL Server instance.  Here is a script to find quickly the stored procedure or command text used by SQL Server’s Job.

Select JB.Name [Job Name], JBSTP.Command [Command Text] from MSDB.dbo.Sysjobs JB
INNER JOIN MSDB.dbo.sysjobsteps JBSTP on JB.Job_ID = JBSTP.Job_ID
where JBSTP.Command Like   ‘%SP or Command Name%’

 

Advertisements
Comments
  1. Paul Tormey says:

    Handy bit of SQL to have…thanks

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s