Drop all connections for a SQL Server database

During a project I had to restore a database a lot to sync database with schema and data between the developers. Due to some technical issues and that we worked at different locations we could not share a common database. I always had a problem with the restore didn’t succeed because there were open connections that used the database. I had to restart the SQL server every time before restoring. This was annoying and time-consuming so I created a stored procedure (after some googling) that drops all connections.

Continue reading Drop all connections for a SQL Server database