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
 General SQL Server Forums
 New to SQL Server Programming
 how to disconnect all the users

Author  Topic 

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2007-10-12 : 09:42:21
Dear All,
i've to drop one database....i'm sure....

but it is saying presently it is in use....
there no no replication....

some user is using....
that is a new database.....how can i throw all users from the database

Vinod
Even you learn 1%, Learn it with 100% confidence.

Kristen
Test

22859 Posts

Posted - 2007-10-12 : 09:49:28
ALTER DATABASE MyDatabase SET SINGLE_USER WITH ROLLBACK IMMEDIATE
Go to Top of Page

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2007-10-12 : 09:58:25
thank you kristen

Vinod
Even you learn 1%, Learn it with 100% confidence.
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2007-10-12 : 10:02:24
I prefer to do it this way, because it prevents anyone, even administrators, from re-connecting:


use master
alter database MyDatabase set offline with rollback immediate


CODO ERGO SUM
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-10-12 : 10:07:48
"set offline"

That's a blinking good idea!

Kristen
Go to Top of Page
   

- Advertisement -