How to import a *.MDF & *.LDF file into SQL Server ?

Posted on 2002-05-20
Last Modified: 2008-03-10

  I got two SQL Server files: product.mdf and product.ldf. How can I import these files(and creat a database for that) into SQL Server by using Enterprise Manager ?


Question by:richardluo
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7022846
Take a look at sp_attach_DB

From SQL Analyzer (assuming you have copied the MDF and LDF to the c:\Program Files\Microsoft SQL Server\MSSQL\Data folder):
EXEC sp_attach_db @dbname = N'Product',
   @filename1 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\product.mdf',
   @filename2 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\product.ldf'


Accepted Solution

TheSpirit earned 100 total points
ID: 7023416
You can do this via enterprise manager, Highlight the databases key on the left hand side, then right click and move on to all tasks, there should be the attach option from there.

Author Comment

ID: 7025109
Thanks guys

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
Introduction In my previous article ( I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question