23 lines
675 B
Transact-SQL
23 lines
675 B
Transact-SQL
USE master; -- Ensure you are connected to the master database
|
|
GO
|
|
|
|
-- Retrieve the last full backup date for the specified database
|
|
SELECT top 10
|
|
b.backup_start_date AS BackupDate,
|
|
CASE
|
|
WHEN b.type = 'D' THEN 'Full'
|
|
WHEN b.type = 'L' THEN 'Log'
|
|
ELSE 'Other'
|
|
END AS BackupType
|
|
FROM msdb.dbo.backupset b
|
|
INNER JOIN (
|
|
SELECT
|
|
database_name,
|
|
MAX(backup_start_date) AS last_backup_date
|
|
FROM msdb.dbo.backupset
|
|
WHERE database_name = 'arizona'
|
|
GROUP BY database_name
|
|
) maxb ON b.database_name = maxb.database_name
|
|
--AND b.backup_start_date = maxb.last_backup_date
|
|
and b.type = 'D'
|
|
order by backup_finish_date desc |