'How to add a default value for a column if it is null OR blank? i.e. a whitespace like ''
I added a constraint for one of my columns, the idea being, if it is blank or null, the default value will be unknown.
ALTER TABLE Persons
ADD CONSTRAINT df_City
DEFAULT 'Unknown' FOR City;
I uploaded some samples, and the constraint works with null, but not with ''.
How can I make it work with ''?
SQL Server 14.0.1000.169
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
