Tuesday, June 19, 2012

Attach MDF File into Database

Below is the script to attach MDF file into database without LOG file. New log file will be create by system.


USE [master]
GO
CREATE DATABASE [SampleDB] ON 
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\SampleDB_Data.mdf' )
FOR ATTACH
GO

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.