Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

3 Answers

up vote 8 down vote accepted
--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
share|improve this answer
add comment

This command should drop all connections, then allow you to detach.

ALTER DATABASE SET SINGLE_USER WITH ROLLBACK_IMMEDIATE

share|improve this answer
add comment

Have you tried checking the "Drop Connections" box when you detach it?

share|improve this answer
    
I was hoping more for a query related solution. Server Management Studio Express very often causes my machine to blue screen. So I'm using a tool that just sends queries to the server. –  Jack B Nimble Oct 20 '09 at 17:54
    
A blue screen is usually related to hardware or OS-level problems, not to some very specific application such as a database management tool. I can't imagine why this particular program makes your machine crash, but this is definitely a symptom of some underlying serious problem. –  Massimo Oct 20 '09 at 18:53
    
It is some combination of Visual Studio and Server Management Studio Express, because I have seen the behavior on 3 different workstations. It might be from running multiple versions of Visual Studio at once, I know this causes bizarre behavior in IE7 when using tabs. –  Jack B Nimble Oct 28 '09 at 18:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.