Trucating trailing zeros

The disable varbinary truncation configuration parameter enables or disables trailing zeros from varbinary and binary null data (see Chapter 5, “Setting Configuration Parameters” in the System Administration Guide, Volume 1).

By default, disable varbinary truncation is off for the server.

When Adaptive Server is set to truncate trailing zeros, tables you subsequently create store the varbinary data after truncating the trailing zeros. For example, if you create the test1 table with disable varbinary truncation set to 0:

create table test1(col1 varbinary(5))

Then insert some varbinary data with trailing zeros:

insert into test1 values(0x12345600)

Adaptive Server truncates the zeros:

select * from test1
col1
------------
0x123456

However, if you drop and re-create table test1 and set disable varbinary truncation to 1 (on) and perform the same steps, Adaptive Server does not truncate the zeros:

select * from test1
col1
------------
0x12345600

Adaptive Server considers data with or without trailing zeros as equal for comparisons (that is, 0x1234 is the same as 0x123400).

Because Adaptive Server stores data according to how disable varbinary truncation is currently set, tables may have a mix of data with or without trailing zeros, although the datatype does not change:

Trailing zeros are preserved in: