Cari Blog Ini

13 Juni 2012

Example of Attach Database Using Syntax SQL

/* Task for : Attach DB */
----------------------------------------------------
-----code:start
----------------------------------------------------
USE [master]
GO

CREATE DATABASE [DB_Test] ON
    ( FILENAME = N'C:\DBTest\DB_Test.mdf' ),
    ( FILENAME = N'C:\DBTest\DB_Test_log.ldf' )
     FOR ATTACH
GO
----------------------------------------------------
-----code:end
----------------------------------------------------

Result Messages:
Command(s) completed successfully.