Blog Pages

sp_dboption 'Single User' command failed

Problem:
USE master
GO

EXEC sp_dboption DBNAME, 'Single User', True
GO

Msg 5070, Level 16, State 2, Line 1
Database state cannot be changed while other users are using the database 'DBNAME'
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
sp_dboption command failed.


Solution:
Use this command:
alter database DBNAME set single_user with rollback IMMEDIATE
GO

No comments:

Post a Comment