Uncategorized

Switch database to single user mode

EXEC sp_dboption 'MyDatabase', 'single user', 'TRUE'
EXEC sp_dboption -- display list of all avaiable options
EXEC sp_dboption 'MyDatabase' -- display list of options set to 1
EXEC sp_dboption 'MyDatabase', 'single user' -- display actual option setting

Running sp_dboption creates checkpoint in database and new setting are applied immediately.