Kill all the current active connection in SQL Server database

There are times when you want to kill all the current active connections of your SQL Server database and you wish to run the database in the single user instance.

Here’s the query on how to do this.

use master
ALTER DATABASE <NameoftheDatabase> SET SINGLE_USER WITH ROLLBACK IMMEDIATE

Once done with any changes , ensure that the MULTI_USER mode is enabled for the database.

ALTER DATABASE <NameoftheDatabase>  SET MULTI_USER

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

When dealing with a relational database management system (RDBMS) like SQL Server, compatibility level is an important concept to understand....
In this blog post, let’s learn about the error message “49975 – Unable to load controller client certificate due to...
In this blog post, let’s learn about the error message “49973 – Cannot remove tempdb remote file to local tempdb...