Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 SQL DB Backup History...

Author  Topic 

petek
Posting Yak Master

192 Posts

Posted - 2013-02-13 : 07:40:36
Hi i have the query below and need some help on getting some data from sysjobhistory to show only jobs that were successful...

SELECT
BS.database_name
, CAST(BF.file_size/1024/1024 AS bigint) AS file_size_mb
, CAST(BF.backup_size/1024/1024 AS bigint) AS consumed_size_mb
, BF.logical_name
, BF.physical_name
, BS.backup_finish_date AS polling_date
FROM msdb.dbo.backupset BS
INNER JOIN msdb.dbo.backupfile BF ON BS.backup_set_id = BF.backup_set_id
WHERE BS.type = 'D'
AND BS.backup_finish_date >= '2013-01-31'
AND BS.database_name not in ('msdb', 'master', 'model')
AND BF.file_size/1024 > 1
AND BF.backup_size/1024 > 1
ORDER BY BS.database_name
, BF.logical_name
, BS.backup_finish_date DESC;

thanks in advance for looking

Kind Regards

Pete.
   

- Advertisement -