Even though nothing is using it I am unable to detach a database because it is use.
Cannot detach the database 'DEMO' because it is currently in use.
I have tried rebooting and get the same message.
Even though nothing is using it I am unable to detach a database because it is use.
Cannot detach the database 'DEMO' because it is currently in use.
I have tried rebooting and get the same message.
--Kick all users off of the database NOW
ALTER DATABASE YourDatabase SET SINGLE_USER WITH ROLLBACK IMMEDIATE
--Kick all but after 60 seconds
ALTER DATABASE YourDatabase SET SINGLE_USER WITH ROLLBACK AFTER 60 SECONDS
--restore connection to users
ALTER DATABASE YourDatabase SET MULTI_USER
Have you tried checking the "Drop Connections" box when you detach it?
Don't forget to check "Drop Connections" from "Detach Database" window, otherwise it's very simple and just choose detach from the menu, see the image below:
This command should drop all connections, then allow you to detach.
ALTER DATABASE SET SINGLE_USER WITH ROLLBACK_IMMEDIATE