SQL Server Most Recent Backup Problem

Resolved SQL
CM
Community Member
September 10, 2015
2 replies
621 views
Reviewed by moderators

I’m using a simple maintenance plan to take nightly backups of some production databases to a UNC path within our network. I want to create a job that will pick these backups up and restore them on to a test server. Either on demand or on a schedule. I’m keeping seven days backup in the UNC target and I want to be restoring the most recent backup.

2 Answers
Accepted Answer
Verified by Edwin J. Hoffer, Expert · Reviewed September 2015

Use the backup history tables in msdb to retrieve the filename and path of the most recent backup.

You can use the date created property from the file system to choose the youngest backup. This was the solution I wanted.