|
A field is referred to as null if it has not
received a value or its value is not clearly identified.
To visually create a null field, display the
table in Design View. In the top section, click the column name. In
its corresponding Allow Nulls section, check or clear the check box.
|
To specify the nullity of a column using SQL, on the
right side of the column creation, type NULL. To
specify that the values of the column are required, on the right side,
type NOT NULL. If you don't specify NULL or NOT NULL, the column
will be created as NULL. Here are examples:
CREATE TABLE Persons
(
FirstName varchar(20) NULL,
LastName varchar(20) NOT NULL,
Gender smallint
);
GO
If the table was already created and it holds some
values already, you cannot set the Allow Nulls option on columns that
don't have values.
After specify that a column would NOT allow NULL values, if
the user tries creating a record but omits to create a value for the column, an
error would display. Here is an example:
This error message box indicates that the user attempted to
submit a null value for a column. To cancel the action, you can press Esc.