SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Null Defaults

By Steve Jones,

One of the things that becomes important in a distributed, team environment is the interface that you present to other systems. In a Devops environment, we really need to have an API for every system, including the database. This means a contract for our database, that spells out what access points are available and what they return. For our data, this often means the structure and shape of a table.

Our tables often aren't static. In fact, they grow and chance over time. This means that the values returned from the table, or even views or stored procedures referencing the table, will change over time. In some sense, this means we're really versioning our API. If that's the case, then as you make additive changes, you'll be adding columns for the most part. The will be time when your application, or maybe a subset of your applications, will not know how to provide data for those columns. In those cases, we need to make a decision about how to handle the column.

What's your default choice? Do you use NULLs when you aren't sure? Perhaps you choose some magic value, such as a blanks or a known date? I know some people like to use 1900-01-01 to mean an unknown date, or even a number such as 99999. Any choice has advantages and disadvantages, and what works for one person might not work for another.

Let us know your default choice and why. I'm sure some of you have great reasons for why you choose a value, and I bet more than a few of us learn something about why one value might be better than others. I'm looking forward to reading your thoughts.

Total article views: 115 | Views in the last 30 days: 1
Related Articles

SQL Server Collation Choices

Interested in opinions on choice of SQL Server collation based on legacy DBs. Is this likely to caus...


Too Much Choice

More information and choice are generally good things, but there can be problems. Steve Jones notes ...


The Flaws of Choice

It's nice to be able to choose what you want, or what might fit you better. Too much choice, however...


The New Data Warehouse Choice

Steve Jones looks a little more closely at the Azure SQL Data Warehouse, perhaps a viable choice for...


The Choices We Make

If you keep your head up and look around you’ll see the choices people make all the time. I saw...