Reputation: 3147
Few new columns needs to be added to an existing table in sql server 2008 R2. New columns are like required field, user can't add a new row without passing any values to those new columns.
In .Net code, there is already a method to validate values before inserting a new record.
Is there an advantage of adding a Not Null constraint on new columns?
Upvotes: 0
Views: 62
Reputation: 95554
If a column should not allow the value NULL
then yes, you should most definitely declare NOT NULL
as part of it's definition. Just because the application handles it now doesn't mean it will later, or that someone will (foolishly) run an INSERT
or UPDATE
statement on your table(s) with SET ColumnName = NULL
.
Upvotes: 6