
Restrict the Connection to a Database in SQL
You can restrict the connection to a database by specifying Single User mode, as shown below: USE master;GOALTER DATABASE YourDatabaseNameSET SINGLE_USERWITH ROLLBACK IMMEDIATE;GOALTER DATABASE YourDatabaseNameSET READ_ONLY;GOALTER DATABASE YourDatabaseNameSET MULTI_USER;GO This means that only one person can connect to the database until it is set back to Multi User.