DB2 has a special value that is 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.
DB2 columns can be defined
so that they do not allow NULL data. For example, NOT NULL would indicate
that DB2 does not allow a row to be added to the TestID.Customers
table 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.
You can also define
DB2 columns as NOT NULL WITH DEFAULT. The following table lists default
values that DB2 assigns to columns that you define as NOT NULL WITH
DEFAULT. An example of such a column is STATE in Testid.Customers.
If a column is omitted from a view descriptor, default values are
assigned to the column. However, if a column is specified in a view
descriptor and it has no values, no default values are assigned.
Default Values That DB2 Assigns for Columns Defined as NOT
NULL WITH DEFAULT
|
|
|
blanks, unless the NULLCHARVAL=
option is specified
|
VARCHAR | LONG VARCHAR
| VARGRAPHIC | LONG VARGRAPHIC
|
|
SMALLINT | INT | FLOAT
| DECIMAL | REAL
|
|
|
current date, derived
from the system clock
|
|
current time, derived
from the system clock
|
|
current timestamp, derived
from the system clock
|
1The default values that
are listed in this table pertain to values that DB2 assigns.
|
Knowing whether a DB2
column allows NULL values or whether DB2 supplies a default value
can assist you in writing selection criteria and in entering values
to update a table. Unless a column is defined as NOT NULL or NOT
NULL WITH DEFAULT, the column allows NULL values.
To
control how the DBMS handles SAS missing character values, use the NULLCHAR= and NULLCHARVAL= data set options.