Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 killing connections

Author  Topic 

Oliver wang
Yak Posting Veteran

50 Posts

Posted - 2011-08-11 : 03:37:43
hello everyone,

Here I got an issue. I want to delte a database on my server. But when I delete, an error pops up saying there are some user connections on the database, which prevent me from doing that. I know one possible way to sovle this is using "kill" command. But what if there are hundreds of user connections? Do I need to kill those connections one by one which is time consuming?

Thank you very much in advance.

regards,

Oliver

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2011-08-11 : 03:40:58
Hm, dropping a database with hundreds of connections sounds like a bad idea. But try this:
USE master
go

EXEC sp_dboption 'databasename', 'single_user', true
go

DROP DATABASE databasename
go


- Lumbago
My blog-> http://thefirstsql.com/2011/07/08/how-to-find-gaps-in-identity-columns-at-the-speed-of-light/
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2011-08-11 : 03:41:17
This

http://www.kodyaz.com/articles/kill-all-processes-of-a-database.aspx

PBUH

Go to Top of Page

Oliver wang
Yak Posting Veteran

50 Posts

Posted - 2011-08-11 : 04:07:16
Hi Folks,

Thanks for your timely response. Your suggestions help me a lot.

regards,

Oliver
Go to Top of Page
   

- Advertisement -