The following example demonstrates how SET NULL affects support for null values. The first table, employee
, is created with SET NULL ON, so its fields support null values. REPLACE is used to place a null value in the cLastName
field. The second table, staff
, is created with SET NULL OFF, so its fields do not support null values. REPLACE is used to place zero in the cLastName
field.
CLOSE DATABASES
SET NULL ON && Fields will support null values
CREATE TABLE employee (cLastName C(20), ySalary Y(12,2))
APPEND BLANK && Add a new blank record
REPLACE cLastName WITH .NULL. && cLastName supports null values
SET NULL OFF && Fields will not support null values
CREATE TABLE staff (cLastName C(20), ySalary Y(12,2))
APPEND BLANK && Add a new blank record
REPLACE cLastName WITH 0 && Doesn't support null values