Tuesday
Jul162013

Kill connections for specified database

In non-production environments I'm frequently tearing down old databases and replacing them with new ones with the same name. Rather than kill all current connections manually I prefer to use this handy system stored procedure: Here's an example of usage where myDbName is the name of the target database that I intend to name to myDbName_OLD and need to terminate all active connections first.