It is way simpler to drop a default constraint if you know its name. But in real life, we often create a column with a default value without giving it a custom name. It works well until we change our mind and want to change the default or even drop it. Then the real problem begins. How to drop default constraint without knowing its name in SQL Server?

Each SQL Server database administrator and database developer has a set of scripts that should always be somewhere close. One of them is the one that kills a bunch of connections to a database. It can be a group of all connections, those made by a particular login or the ones using a specific database. No matter what actual conditions are, killing dozens or hundreds connections manually is not fun. Here are provide an SQL script that can be easily customized to cover a specific need. The below version destroys all non-background connections to a database called MyDatabase.