Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checking if SQL Server database is running in MULTI_USER mode

Tags:

sql-server

How can I check what mode a particular database is in?

like image 859
Toby Avatar asked Dec 17 '22 20:12

Toby


2 Answers

try using the DATABASEPROPERTYEX

SELECT DATABASEPROPERTYEX('databasename','UserAccess')

if the database is in multi_user mode must return MULTI_USER

like image 52
RRUZ Avatar answered May 03 '23 07:05

RRUZ


use sp_dboption like this

EXEC sp_dboption 'DB_NAME', 'single user'

to set it add the option third parameter. See below

alt text

like image 42
Preet Sangha Avatar answered May 03 '23 06:05

Preet Sangha