I have an .mdf file, and I'd like to create a database from it on my computer. But I'd like to create it without attaching it to the .mdf file.
Is this possible?
I have an .mdf file, and I'd like to create a database from it on my computer. But I'd like to create it without attaching it to the .mdf file.
Is this possible?
You can create database from your mdf file,please see my example below
USE [master]
GO
CREATE DATABASE [DatabaseName] ON
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\...mdf' ),
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.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'