Pages

Wednesday, October 10, 2012

Fastest Way to kill all user connections of SQL Server Database

Kill all the user connected to the User database in SQL Server:


If we want to kill any connection in SQL Server
We do

KILL SPID
EG: Kill 59

What if there are 1000 connections and we want to kill all the connections.
Fastest way to kill all the existing user connections in SQL Server is

Alter database AdventureWorksDW
set single_user with Rollback immediate;
Go
Alter database AdventureWorksDW
set multi_user
Go

Hope the above information helps

Thanks