BINARY data types and trailing zeros [CR 484687]

The compatibility information regarding the treatment of trailing zeros with BINARY data types in Chapter 4, “SQL Data Types” is not correct. In the section “Compatibility,” the first sentence and Table 4-4 should be replaced with the following:

“The treatment of trailing zeros in binary data types is different in Sybase IQ, Adaptive Server Anywhere, and Adaptive Server Enterprise. Table 4-4 shows the differences.”

Table 4-4: Treatment of trailing zeros

Data type

Sybase IQ

SQL Anywhere

ASE

BINARY NOT NULL

padded

not padded

padded

BINARY NULL

padded

not padded

not padded

VARBINARY NOT NULL

truncated, not padded

truncated, not padded

truncated, not padded

VARBINARY NULL

truncated, not padded

truncated, not padded

truncated, not padded

The following clarification should be added to the section “Treatment of trailing zeros” in the “Notes” section:

When you select a BINARY value, you must specify the value with the padded zeros or use the CAST function. For example,

SELECT * FROM zeros WHERE bnot = 0x0123000000;

or

SELECT * FROM zeros WHERE bnot = CAST(0x0123 as binary(5));