Hi @Sharon01
want to check the retention period , or how long the backup file will stay on he media , before it gets deleted
How about this query:
SELECT CONVERT(CHAR(100), SERVERPROPERTY('Servername')) AS Server,
msdb.dbo.backupset.database_name,
msdb.dbo.backupset.expiration_date,
DATEDIFF(DAY,GETDATE(),msdb.dbo.backupset.expiration_date) AS Retention_Days,
CASE msdb..backupset.type WHEN 'D' THEN 'Database'
WHEN 'L' THEN 'Log' END AS backup_type,
msdb.dbo.backupset.backup_size,
msdb.dbo.backupset.name AS backupset_name,
msdb.dbo.backupset.description
FROM msdb.dbo.backupset
ORDER BY msdb.dbo.backupset.database_name,msdb.dbo.backupset.backup_finish_date
Best regards,
Cosmog Hong
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.