script which will give present existing Jobs in the sql server instance

  • hi,

    i need a script which will give present existing Job names in the sql server instance.

    thanks

    Arjun

  • query the sysjobs table in the MSDB database for the info you need

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" ๐Ÿ˜‰

  • can you give the query for this

  • SELECT job.job_id,notify_level_email

    ,name,enabled,description

    ,step_name,command,server,database_name

    FROM msdb.dbo.sysjobs job JOIN

    msdb.dbo.sysjobsteps steps

    ON job.job_id = steps.job_id

    WHERE job.enabled = 1

  • also gets the category name and filters out the report server jobs.

    SELECT sysjobs.name 'Job Name',

    syscategories.name 'Category',

    CASE [description]

    WHEN 'No Description available.' THEN ''

    ELSE [description]

    END AS 'Description'

    FROM msdb.dbo.sysjobs

    INNER JOIN msdb.dbo.syscategories ON msdb.dbo.sysjobs.category_id = msdb.dbo.syscategories.category_id

    WHERE syscategories.name <> 'Report Server'

    ORDER BY sysjobs.name

  • SQLDBA ARJUN (10/5/2012)


    hi,

    i need a script which will give present existing Job names in the sql server instance.

    thanks

    Arjun

    This article[/url] will help you write your own script.

    โ€œWrite the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.โ€ - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

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

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