Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)


By fhanlon,

This script originally created by Greg Larsen has been modified by me. This procedure is used to create the restore commands needed to restore a database using the lates full and any transaction or differential backups. The parameter @dbname was added to just create the restore statements for a particular database. Leaving off this parameter will create the restore commands for all databases. I use 3rd part compression software (SQL Backup) to the restore statement created will depend on the backup name. In this case I assumed if the extension for the backup filename is sqb then the backup is compressed and a SQL Backup restore command is created; otherwise a native SQL Server restore statement is generated. If you use Litespeed of some other 3rd party backup software this statement must be modified slightly. Otherwise normal SQL restore statements are generated. The results can be cut and pasted into another window for execution. I store this proc in a DBA databases that I attach to each server. Hope it helps

Total article views: 1194 | Views in the last 30 days: 1
Related Articles

database backup and restore in sql server 2005

database backup and restore using java


Restore from Backup with Replicated Database

Restore from Backup with Replicated Database


Restore with no backup

Database dropped, no backup. Need to restore


Restore database with all necessary files

It creates the script for restoring your database with all the backups (full, differential and trans...


Restore Latest Backup with Powershell

Restores the latest backup of a database to a destination server of your choice, and creates a new b...