Monday, January 4, 2010

drop database

-- drop kick any connections to database "foo" and roll back their transactions
ALTER DATABASE foo
SET SINGLE_USER
WITH ROLLBACK IMMEDIATE

-- Drop the database "foo"
USE MASTER
GO

DROP DATABASE foo

1 comment:

Sam said...

As exepcted, this will also remove the underlying mdf, ndf and ldf files from hard drive, freeing up space.