Changing SQL database to single user mode and back to Multi User mode
It is often necessary to change the database to single user mode, especially if you are a DBA. A simple example would be to change the collation settings or any DB settings. The single user will allow only one user ( usually DBA) to access the database. Hence it will be easy to make changes without the worry of deadlocks or any other type of contention for DB and also without affecting the users.
It is very easy to change the database to Single user mode; in fact, it is just an execution of the script away. Use the script below to change the mode.
ALTER DATABASE <<Database Name>> SET SINGLE_USER WITH NO_WAIT