SQL Server Central is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
Search:  
 
 

Restore database with all necessary files

By Josep, 2008/02/12

Total article views: 884 | Views in the last 30 days: 92

This script creates the script to restore your database with the information existing in [msdb] database.
It helps you by finding the last FULL backup, the last DIFFERENTIAL backup and all the TRANSACTION LOG backups needed.
It's quite comfortable when you are doing so many differential or log backups.
I hope you enjoy it!!!

This script is based on the script done by [jtshyman] named "List SQL backups"

The variable @DBName should be set to the name of the database you want to query on.
It is not case sensitive unless your collation is.

The variable @Days should be set to how many days back in the records you want to list backups for. By default set to 14 (old enought I think).

By Josep, 2008/02/12

Total article views: 884 | Views in the last 30 days: 92
Your response
 
 
Related tags

Backup     SQL Server 2000    
Restore     T-SQL Aids    
 
Related content

_Select Update

By JON RICE | Category: T-SQL Aids
| 262 reads

Backup Stored Proc

By Scott Duncan | Category: Backup
| 2,506 reads
Like this? Try these...

SQL Server T-SQL in 10 Minutes

By Steve Jones | Category: Book Reviews
(not yet rated) | 2,071 reads
Already registered?  

Free registration required

To read the rest of this article, and access thousands of other articles, we ask you to register on the site and subscribe to our newsletters.

Register

E-mail address:
Password:
Password (confirm):

  

Subscriptions

We ask you to register on the site and subscribe to our newsletters. Subscribing to our newsletters gets you:

  • ALL of our content (thousands of articles, scripts, and forum postings)
  • A daily newsletter (example)
  • A weekly news round up (example)
  • The opportunity to ask and answer questions in our forums
  • A daily Question of the Day to test and help you increase your knowledge of SQL Server.

We ask that you give the newsletter a try for a week. Over 200,000 SQL Server Professionals a day find it entertaining and useful. If not, you are welcome to unsubscribe at anytime.

Steve Jones
Editor, SQLServerCentral.com