Allowing NULL values on a column is normally done to allow the absense of a value to be represented. When using NVARCHAR there is aldready a possibility to have an empty string, without setting the column to NULL. In most cases I cannot see a semantical difference between an NVARCHAR with an empty string and a NULL value for such a column.
Setting the column as NOT NULL saves me from having to deal with the possibility of NULL values in the code and it feels better to not have to different representations of “no value” (NULL or an empty string).
Will I run into any other problems by setting my NVARCHAR columns to NOT NULL. Performance? Storage size? Anything I’ve overlooked on the usage of the values in the client code?
A
NULLindicates that the value in the column is missing/inapplicable. A blank string is different because that is an actual value. ANULLtechnically has no data type where as a blank string, in this case, is nvarchar.I cant see any issues with having default values rather than
NULLvalues.In fact, it would probably be beneficial as you wouldn’t have to worry about catering for
NULLvalues in any of your queriese.g
much easier than
You should use default constraints in your DDL to ensure that no rogue
NULL‘s appear in your data.