Retrieve the Last Backup Dates for All Databases in an MS SQL Instance

30 Mar, 2021·
AlexIn Tech
AlexIn Tech
· 1 min read

Retrieve the Last Backup Dates for All Databases in an MS SQL Instance

Here’s a handy SQL script to check when your databases were last backed up on an MS SQL instance.

SELECT sdb.Name AS DatabaseName,
COALESCE(CONVERT(VARCHAR(12), MAX(bus.backup_finish_date), 101),'-') AS LastBackUpTime
FROM sys.sysdatabases sdb
LEFT OUTER JOIN msdb.dbo.backupset bus ON bus.database_name = sdb.name
GROUP BY sdb.Name

Enjoy! ;-)

Share
AlexIn Tech
Authors
SysOps Engineer | IT Consultant | IT Teacher
Alexis is a SysOps Engineer and IT teacher at ETML in Lausanne. Rooted in systems and infrastructure, he combines automation and custom development with a growing interest in AI to solve practical problems. He offers IT consulting, custom solutions, and hosting.