How to Kill Database Connections (SQL Server)

October 26, 2017 // In: How To

During Data migration process I have to restore or drop databases. Sometime I face an error

SQL Server Cannot drop database <dbname> It is currently in use“.

Few days ago, I faced the same problem. As you know,¬† It’s very expensive to restart SQL Services to kill database connections when any other database is also being used by other developer / application. So the option left for me is to kill all connections against a specific database via SQL Query.

I used following query to kill database connections.

Replace YourDatabaseNameHere with your database name.

How to Fix WordPress 403 Forbidden Error while Posting