I was trying to take offline my database in SQL Server but getting above error. Usually there is an open connection to a database which need to be killed.
To view connections:
EXEC sp_who2
Check for any connections open to the database and get the SPID.
Now execute:
KILL <SPID>
SPID is sql server process ID which is assigned by SQL Server when connected to database.
HTH
To view connections:
EXEC sp_who2
Check for any connections open to the database and get the SPID.
Now execute:
KILL <SPID>
SPID is sql server process ID which is assigned by SQL Server when connected to database.
HTH