use master
drop database db_name
Most of the time, this can succeed. If the same error message still pops up, disconnect query analyzer or management studio from the SQL Server and reconnect to it and run the above t-sql command again.
From novice to professional on SQL Server technology
use master
ReplyDeletego
alter database [db_name] set single_user with rollback immediate
go
The best way to to flush out all the users currently logged on to the database is to set the database into single user mode and the script in the last comment does exactly this.
ReplyDelete