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
 Close Connection

Author  Topic 

joelseverich
Starting Member

34 Posts

Posted - 2010-07-23 : 09:28:18
Hi,

is there a way to close all database connections

'cause when i try to drop the database a messege says database is in use

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-07-23 : 10:16:20
Try this:

ALTER DATABASE <dbname> SET SINGLE_USER WITH ROLLBACK IMMEDIATE

GO

Also make sure after the restore make it multi user again by following the below code:

ALTER DATABASE <dbname> SET MULTI_USER
GO



I am here to learn from Masters and help new bees in learning.
Go to Top of Page
   

- Advertisement -