BINARY and VARBINARY Data Types

The BINARY data type is a fixed-length binary value with a length of n bytes, where the value of n ranges from 1 to 8300 bytes. The BINARY data type requires n bytes of storage. Data is padded to the maximum column size with trailing zeros. Zero padded comparison semantics are used.

The VARBINARY data type is a variable-length binary value having a maximum length of n bytes, where the value of n ranges from 1 to 4,194,304 (222) bytes.

The following example creates a table and defines two columns: col1 is defined with data type BINARY and col2 with data type VARBINARY. Then, binary data is inserted into each column. Note that the BINARY value is padded to the right with zeros.

Note:

See the description for the HexadecimalLiteral in "Constants" for details on assigning hexadecimal literals as binary data in TimesTen.

Command> CREATE TABLE bvar (col1 BINARY (10), col2 VARBINARY (10));
Command> DESCRIBE bvar;
Table USER1.BVAR:
  Columns:
    COL1                            BINARY (10)
    COL2                            VARBINARY (10) INLINE
1 table found.
(primary key columns are indicated with *)

Command> INSERT INTO bvar (col1, col2) VALUES (0x4D7953514C, 0x39274D);
1 row inserted.

Command> SELECT * FROM bvar;
 < 4D7953514C0000000000, 39274D >
1 row found.