Taking a database offline in SQL Server 2008 and avoid transition error message
Taking a database offline is a very simple task. Right click on it and select ‘Take offline’. However, if the database is being used at the moment the action will fail and your database may remain in limbo for a (sometimes long) while.
Msg 952, Level 16, State 1, Procedure sp_who, Line 79
Database ‘UATdb’ is in transition. Try the statement later.
Try this instead:
ALTER DATABASE UATdb SET OFFLINE WITH ROLLBACK IMMEDIATE