Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2002-05-20
3
Medium Priority
?
673 Views
Last Modified: 2008-03-10
Hi,

  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 ?


Thanks

Richard
0
Comment
Question by:richardluo
3 Comments
 
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'

Anthony
0
 
LVL 4

Accepted Solution

by:
TheSpirit earned 400 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.
0
 

Author Comment

by:richardluo
ID: 7025109
Thanks guys
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
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…

926 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