Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SELECT bk.database_name AS Name,
bk.recovery_model AS RecoveryModel,
bk.backup_finish_date AS LastBackupDate,
bk.Type,
bk.backup_size AS LastBackupSize
FROM msdb.dbo.backupset AS bk
INNER JOIN (
SELECT database_name,
MAX(backup_finish_date) AS LastBackupDate,
Type
FROM msdb.dbo.backupset
GROUP BY database_name,Type
) AS bkmax
ON bk.database_name = bkmax.database_name and
bk.backup_finish_date = bkmax.LastBackupDate and
bk.type = bkmax.type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment