Thursday, June 2, 2011

Last Backup Date of SQL DBs

SELECT sdb.Name AS DBName,
COALESCE(CONVERT(VARCHAR(20), MAX(bus.backup_finish_date), 100),'No Backup Yet') AS LastBackUpDate FROM sys.sysdatabases sdb LEFT OUTER JOIN msdb.dbo.backupset bus ON bus.database_name = sdb.name
GROUP BY sdb.Name

No comments:

Post a Comment

 
span.fullpost {display:inline;}