6

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?

2 Answers 2

8

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.

3
  • I tried that and got this error: Cannot drop database "Calendar" because it is currently in use.
    – Austin
    Jul 31, 2009 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, 2009 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, 2009 at 19:43
2

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .