Cari Blog Ini

13 Juni 2012

Example of Detach Database Using Syntax SQL - sp_detach_db

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

ALTER DATABASE [DB_Test]
    SET  SINGLE_USER WITH ROLLBACK IMMEDIATE
GO

USE [master]
GO

EXEC master.dbo.sp_detach_db @dbname = N'DB_Test'
GO
--------------------------------------------------------------------
-----code:end
--------------------------------------------------------------------



Result Messages:
Command(s) completed successfully.