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

I've got a Windows 2003 server with SQL Server 2005 and when I log into the Management Studio, right-click on a Database and choose "Delete" I get the Delete Object dialogue. I then click OK at the bottom and it grays out the dialogue and shows a spinning indicator but doesn't finish. I've let it run for 5 or 10 minutes and it seems to eat up the CPU, but not do anything. The database I'm trying to delete is very small (a few tables with maybe 1-3 mb of data). Any ideas?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

When you drop the database the UI is going to also try and delete the backup and restore history for the database from the MSDB database. Dry using the DROP DATABASE statement from a query window, then clean up the database backup history manually.

share|improve this answer
    
I tried that and got this error: Cannot drop database "Calendar" because it is currently in use. –  Austin Jul 31 '09 at 19:26
    
Okay, I got DROP DATABASE to work. You can't have the database you want to delete selected when you run the DROP DATABASE call in the Query Editor. Thanks for the help. That is bothersome that the delete was hanging in SQL Server though –  Austin Jul 31 '09 at 19:30
    
How long has the server been online? Do the databases on the server get backed up regularly? I'll bet is you check the tables in the msdb database you'll find quite a few records for the Calendar database. –  mrdenny Jul 31 '09 at 19:43

you can also use this command:

ALTER DATABASE [foo] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;

GO

DROP DATABASE [foo];

GO

Where foo is the db name

share|improve this answer

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.