tags:

views:

11

answers:

2

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

+2  A: 

use sp_dboption like this

EXEC sp_dboption 'DB_NAME', 'single user'

to set it add the option third parameter. See below

alt text

Preet Sangha
Does that not set it? I want to report back on it's current state (because I am not convinced setting it to multi_user has worked.)
Toby
no its for read and write.
Preet Sangha
I did not know that, thought you could only set things with it, thanks for the answer but as you say in another comment, there is a quicker way.
Toby
+2  A: 

try using the DATABASEPROPERTYEX

SELECT DATABASEPROPERTYEX('databasename','UserAccess')

if the database is in multi_user mode must return MULTI_USER

RRUZ
Thank you, exactly what I was looking for.
Toby
nice one. I reckon this way faster than mine.
Preet Sangha