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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

809 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