Question

  Asked: Mar 19 2008   0:01 AM GMT
  Asked by: SQL Server Ask the Experts


How can I restore a database from .mdf file? I only have .mdf backup file.


SQL Server database restore, SQL Server backup

How can I restore a database from .mdf file? I only have .mdf backup file.

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



You can attach just the MDF file using the sp_attach_single_file_db system stored procedure.

The example from BOL is:
EXEC sp_attach_single_file_db @dbname = 'AdventureWorks', 
@physname = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data.mdf';
  • AddThis Social Bookmark Button

Browse more Questions and Answers on SQL Server.

Looking for relevant SQL Server Whitepapers? Visit the SearchSQLServer.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register