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

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
richardluoAsked:
Who is Participating?
 
TheSpiritConnect With a Mentor Commented:
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
 
Anthony PerkinsCommented:
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
 
richardluoAuthor Commented:
Thanks guys
0
All Courses

From novice to tech pro — start learning today.