Clear all connections to a MSSQL database

Simple script to close all connections to a MSSQL database.

USE master;
GO
ALTER DATABASE dbName
SET SINGLE_USER
WITH ROLLBACK IMMEDIATE;
GO
ALTER DATABASE dbName
SET MULTI_USER;
GO
This entry was posted in MSSQL and tagged . Bookmark the permalink. Both comments and trackbacks are currently closed.

2 Comments

  1. fc
    Posted December 28, 2010 at 7:57 pm | Permalink

    It worked!
    Thank you a lot

  2. nupur
    Posted February 28, 2011 at 6:40 am | Permalink

    It worked. thanks.