October 22, 2008 at 11:37 pm
Dear All,
I have downloaded MDF of my database from live server to local server.
Now I want to create a database in loocal server pointing to this MDF file.
How can I do it..?
Thanks in advance.
Santhu.
October 22, 2008 at 11:43 pm
nairsanthu1977 (10/22/2008)
Dear All,I have downloaded MDF of my database from live server to local server.
Now I want to create a database in loocal server pointing to this MDF file.
How can I do it..?
Thanks in advance.
Santhu.
Attach that MDF
USE [master]
GO
CREATE DATABASE [database_name] ON
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Data\ .mdf' ),
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Data\ .ldf' )
FOR ATTACH ;
GO
in case if you dont have the /ldf file : use this
EXEC sp_attach_single_file_db @dbname = 'pubs',
@physname = 'C:\MSSQL\Data\pubs.mdf'
kshitij kumar
kshitij@krayknot.com
www.krayknot.com
April 19, 2013 at 9:30 am
Good Post.
I forgot how to create a database from the .mdf and .ldf file but this reminded me.
Thanks
September 29, 2014 at 10:01 am
Restoring Orphaned MDF File in SQL Server
http://www.sqlserverbox.com/restoring-orphaned-mdf-file-in-sql-server.html
http://sqlism.blogspot.com/2014/09/restoring-orphaned-mdf-file-in-sql.html
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply