drop default constraint

How to drop default constraint without knowing its name in SQL Server

How to drop default constraint without knowing its name in SQL ServerxAI face

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?

 

Script to kill all database connections

killConnectionsEach 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.

Database development environment with Windocks and Liquibase

Database development environment with Windocks and Liquibase

small

I cannot imagine a project in a reputable company without a development environment. A place where developers could deploy unfinished code, test it, play with it or do ad-hoc manual changes without making any trouble to their colleagues. All projects have such place you could say. Not really I would respond.

 

 

Forget about BINARY_CHECKSUM in SQL Server!

Forget about BINARY_CHECKSUM in SQL Server!

checksum smallSQL Server has a few functions that allow calculating a hash from a single value or multiple values. They could be very useful if they worked reliably. Unfortunately, they do not. This article shows how to use CHECKSUM and BINARY_CHECKSUM functions and why you should not rely on them. And I do not only mean the collision probability!

Why my view does not show this column?

Why my view does not show this column?

viewWhen using SQL Server you may have an impression that not everything works exactly how you would expect. One of those things may be a view that does not contain a column that you added to the source table. In this article I will explain you why it works like that and how to refresh columns in the view. 

If you like what I do, consider buying me a coffee :)

Buy me a coffeeBuy me a coffee