Create a Database in case of having both .MDF and .LDF files

Professionaluser
Posted by Professionaluser under Sql Server category on | Points: 40 | Views : 1037
If you have both .MDF and .LDF files for any database, then simply you can create a database by using below query

USE [master]
GO
CREATE DATABASE [AdventureWorksDW2012 ] ON
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER2012\MSSQL\DATA\AdventureWorksDW2012.mdf ' ),
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER2012\MSSQL\DATA\AdventureWorksDW2012.ldf ' )
FOR ATTACH ;
GO

Comments or Responses

Login to post response