Search SQL Agent jobs

  • On my server I have MANY jobs under SQL Agent.

    I am trying to find the one job that is executing a certain stored procedure (spt_Import_DUS)

    Does anyone have a script or something to help me search all jobs - instead of me going through each job in Management Studio?

    I have so many jobs running on the server, with each job having multiple steps and I guess it would take me forever if I have to go through each one manually.

    Any help/ideas?

  • I think sysjobsteps table in msdb database describes each job step in your environment, I would start there.

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
  • Hi,

    Here's a template script to get you going:

    use msdb

    go

    select top 10 s.job_id, [name] as job_name, s.description as job_description

    from sysjobs s join sysjobsteps st

    on s.job_id = st.job_id

    Thanks,

    Phillip Cox

  • this is perfect - thanks!

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply