How to Disconnect / Kick All Users from MSSQL Server Database

You can use one of the below 2 methods to kick all the users from the SQL server session.

Method 1: Using the SQL Server Management Studio

Use MSSQL Server Management Studio to set the database into single user mode. Click Yes to disconnect all the users.

Disconnect MSSQL Users SQL Studio

Method 2: Using Command Line

Execute below command.

ALTER database DATABASE-NAME SET SINGLE_USER with ROLLBACK IMMEDIATE;
 
Nonqualified transactions are being rolled back. Estimated rollback
completion: 100%.

You May Also Like

Leave a Reply?