views:

17

answers:

1

How can i check with SQL query whether Database backup JOB is created or not ?

Thank You

A: 

This query will return all jobs that have the command BACKUP DATABASE in them:

SELECT  SV.name,
        SV.description,
        S.step_id
FROM    msdb.dbo.sysjobs_view SV
INNER JOIN msdb.dbo.sysjobsteps S ON SV.job_id = S.job_id
WHERE   s.command LIKE '%BACKUP DATABASE%'

If you setup the job categories properly to have a category called 'Database Backup' the following would also work:

SELECT  SV.name,
        SV.description
FROM    msdb.dbo.sysjobs_view SV
INNER JOIN msdb.dbo.syscategories SC ON SV.category_id = SC.category_id
WHERE SC.Name = 'Database Backup'
WilliamD