Restore most current backup.

  • Hi, I have a server that keeps 3 days of full backups on disk. Occasionally I need to restore the most current full backup in test and dev. Backup files are named like this

    "FULL_(local)_MYBACKUP_20080701_203440.sqb".

    Every backup file has the date and time appended to it.

    I would like to be able to run a T-SQL command that will find the most current full backup in the directory. Currently I need to change the file name every time I need to restore. My goal is to setup a SQL agent job that will restore the backup in test and dev without any changes to the restore script. Any ideas or ways to do this are appreciated.

    Thanks

  • Try querying the msdb.dbo.backupset table and take the latest entry for the database that you want to be restored.

    Manu

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply