Null substitution values

When a row containing NULL values is fetched from a server, Client-Library substitutes specified “null substitution values” for the null columns when copying the row data to program variables.

Table 3-4 lists Client-Library’s default null substitution values:

Table 3-4: Default null substitution values

Destination type

Null substitution value

CS_BINARY_TYPE

Empty array

CS_VARBINARY_TYPE

Empty array

CS_BIT_TYPE

0

CS_CHAR_TYPE

Empty string

CS_VARCHAR_TYPE

Empty string

CS_DATE_TYPE

4 bytes of zeros

CS_DATETIME_TYPE

8 bytes of zeros

CS_DATETIME4_TYPE

4 bytes of zeros

CS_BIGDATETIME

8 bytes of zeros

CS_BIGTIME

8 bytes of zeros

CS_TINYINT_TYPE

0

CS_SMALLINT_TYPE

0

CS_BIGINT_TYPE

0

CS_INT_TYPE

0

CS_UINT_TYPE

0

CS_UBIGINT_TYPE

0

CS_USMALLINT_TYPE

0

CS_DECIMAL_TYPE

0.0 (with default scale and precision)

CS_NUMERIC_TYPE

0.0 (with default scale and precision)

CS_FLOAT_TYPE

0.0

CS_REAL_TYPE

0.0

CS_MONEY_TYPE

$0.0

CS_MONEY4_TYPE

$0.0

CS_BOUNDARY_TYPE

Empty string

CS_SENSITIVITY_TYPE

Empty string

CS_TEXT_TYPE

Empty string

CS_UNITEXT_TYPE

Empty string

CS_TIME_TYPE

4 bytes of zeros

CS_XML_TYPE

Empty string

CS_IMAGE_TYPE

Empty array

To change null substitution values, an application can call the CS-Library routine cs_setnull.