MSSQL uses alter command to change from multi_user mode to single_user and vice versa

Open a SQL Server Management Studio query window connected to database “master”

For single user mode:

ALTER DATABASE DatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE

For multiuser mode:

ALTER DATABASE DatabaseName SET MULTI_USER WITH ROLLBACK IMMEDIATE

Optionally we can use WITH ROLLBACK AFTER 30 or  WITH ROLLBACK NO_WAIT depending upon our needs !!

Advertisements