DB2 has a special value called NULL. A DB2 NULL value
means an absence of information and is analogous to a SAS missing
value. When
SAS/ACCESS reads a DB2 NULL value, it interprets it as
a SAS missing value.
You can define a column
in a DB2 table so that it requires data. To do this in SQL, you specify
a column as NOT NULL. NOT NULL tells SQL to only allow a row to be
added to a table if there is a value for the field. For example, NOT
NULL assigned to the field CUSTOMER in the table SASDEMO.CUSTOMER
does not allow a row to be added unless there is a value for CUSTOMER.
When creating a DB2 table with
SAS/ACCESS, you can use the
DBNULL= data
set option to indicate whether NULL is a valid value for specified
columns.
DB2 columns can also
be defined as NOT NULL WITH DEFAULT. For more information about using
the NOT NULL WITH DEFAULT value, see your DB2 SQL reference documentation.
Once you know whether
a DB2 column enables NULLs or the host system supplies a default value
for a column that is defined as NOT NULL WITH DEFAULT, you can write
selection criteria and enter values to update a table. Unless a column
is defined as NOT NULL or NOT NULL WITH DEFAULT, it allows NULL values.
To
control how the DBMS handles SAS missing character values, use the NULLCHAR= and NULLCHARVAL= data set options.