-
Quickly Disconnecting SQL Users from a Database
On SQLServerCentral.com tonight, I found a really neat little SQL procedure written by Brian Knight that allows you to disconnect any users currently connected to a specific database.
I needed this script so I could disconnect all of the CRM users so I could perform some maintenance on the CRM databases.
Development, Dynamics CRM 5,171 views3 responses to “Quickly Disconnecting SQL Users from a Database”
-
The following command will disconnect all users and make sure that users cannot logon while you are making your changes…
ALTER DATABASE dbName SET SINGLE_USER WITH ROLLBACK IMMEDIATE
You can allow access again with the MULTI_USER option
-
mitch April 4th, 2006 at 20:22
Excellent suggestion! Thanks Darrel.
-
Clyde March 8th, 2010 at 02:25
How do you force[diconnect] all connected users from the database, I'm trying to delete a database and it gives me an error saying that there is a connected user and it is in a single_user state
Leave a reply
-



