List all jobs associated with a database

  • Hi,

    Is there any T-SQL script or stored procedure that will list all the jobs associated with a database,instead of checking manually ??

    I really appreciate all of you for attempting to help me out.

  • The only thing really would be to check the steps.

    You could query msdb.dbo.sysjobsteps, but that will only tell you the DB which is in the step screen, it wont tell you if the T-SQL SSIS package etc cross over multiple DB's.

  • exec msdb.dbo.sp_help_jobstep @job_id = @job_id

    command column gives you and subsystem must be t-sql

  • If you just need to know the name of the jobs, use the query below (replace name_of_your_database):

    SELECT js.job_id,

    name

    FROM msdb.dbo.sysjobsteps js

    INNER JOIN msdb.dbo.sysjobs_view jv

    ON js.job_id = jv.job_id

    WHERE database_name = <name_of_your_database>

    ~ Lokesh Vij


    Guidelines for quicker answers on T-SQL question[/url]
    Guidelines for answers on Performance questions

    Link to my Blog Post --> www.SQLPathy.com[/url]

    Follow me @Twitter

  • Hi,

    Thanks for the reply.

    This is what i was searching for.Thanks a lot.:-D

  • Abhilash_A (10/4/2012)


    Hi,

    Thanks for the reply.

    This is what i was searching for.Thanks a lot.:-D

    You are welcome Abhilash 🙂

    ~ Lokesh Vij


    Guidelines for quicker answers on T-SQL question[/url]
    Guidelines for answers on Performance questions

    Link to my Blog Post --> www.SQLPathy.com[/url]

    Follow me @Twitter

Viewing 6 posts - 1 through 5 (of 5 total)

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