Binary Datatypes

Binary datatypes store raw binary data, such as pictures, in a hexadecimal-like notation.

Binary data begins with the characters “0x” and includes any combination of digits and the uppercase and lowercase letters A – F. The two digits following “0x” in binary and varbinary data indicate the type of number: “00” represents a positive number and “01” represents a negative number.

If the input value does not include “0x,” SAP ASE assumes that the value is an ASCII value and converts it.

Note: SAP ASE manipulates the binary types in a platform-specific manner. For true hexadecimal data, use the hextoint and inttohex functions.
Use the binary(n) and varbinary(n) datatypes to store data up to 255 bytes in length. Each byte of storage holds 2 binary digits. Specify the column length with n, or use the default length of 1 byte. If you enter a value longer than n, SAP ASE truncates the entry to the specified length without warning or error.

When you create a binary column that allows nulls, SAP ASE converts it to a varbinary column and uses the storage rules for that datatype.

You can search binary strings with the like keyword and operate on them with the string functions.

Note: Because the exact form in which you enter a particular value depends upon the hardware you are using, calculations involving binary data may produce different results on different platforms.
Related concepts
Transact-SQL Functions