How to set database as Single User TIP #10

Sometimes it is require to  set database as single user for maintenance or other recovery purpose.

We need to write following statement

GO

ALTER DATABASE FriendsDB
SET SINGLE_USER 
WITH  ROLLBACK IMMEDIATE;

GO

Here ROLLBACK IMMEDIATE  means if any transaction going on by other user then Rollback that data.

See below snap for more detail

Single_User_DB

SEt_Single_User_Result

Enjoy !!!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

code