Create database from mdf file : Create Database « Database « SQL Server / T-SQL






Create database from mdf file


CREATE DATABASE your_database_name
ON PRIMARY (FILENAME = 'C:\dat.mdf')
FOR ATTACH
GO

drop database your_database_name
GO


           
       








Related examples in the same category

1.Create database by setting the mdf file, size, maxsize and file growth rate
2.Create a database: simplest statement