Adding a CHECK
constraint to an existing column
To add a CHECK
constraint to a column, use one of the following syntaxes:
alter table Stk add check (Amt is not null)
alter table Stk add constraint AmtNotNull check (Amt is not null)
The second form is preferred because it gives you an easy handle to drop the check, but the constraints themselves function exactly the same.As you may have expected, existing NULL
s in the column will remain, can be backed up and restored, etc.etc. — see [nullguide-add-check-not-null-field].