Wednesday, March 25, 2009

How to Alter a SQL Server Database as Single User Mode and as Multi User Mode

You can use the SQL Server Enterprise Manager for SQL Server 2000 to set a database to a single user mode or to multi user mode. Similarly, SQL Server Management Studio can be used for SQL Server 2005 for changing a database to single user mode or to multi user mode. Also you can alter the database access mode by using sql commands like ALTER DATABASE and sp_dboption.


 


ALTER DATABASE [MyDBName] SET MULTI_USER WITH NO_WAIT


ALTER DATABASE [MyDBName] SET SINGLE_USER WITH NO_WAIT


or


EXEC sp_dboption 'MyDBName', 'single user', 'false'


EXEC sp_dboption 'MyDBName', 'single user', 'true'

No comments:

Post a Comment