Single User

Contained Database–A new feature in SQL SERVER 2012 TIP #81

While working on a project sometimes it happened that we need to shift the database from one server to another due to various reason (sometimes it is only money ). We are aware that this easy step take backup and restore another machine but glitch is what about the users which have access to the …

How to find what is currently running on your SQL SERVER? TIP # 12

When we are keen to know that what is currently running on SQL SERVER for analysis purpose then with the help of below SQL statement we can easily find those statements, Stored procedure, status etc. GoSELECT [Spid] = session_Id, ecid, [Database] = DB_NAME(sp.dbid), [User] = nt_username, [Status] = er.status, [Wait] = wait_type, [Individual Query] = …

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 FriendsDBSET 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 Enjoy !!!