VARBYTE Data Type | Data Types and Literals | Teradata Vantage - VARBYTE Data Type - Advanced SQL Engine - Teradata Database

SQL Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
zsn1556242031050.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1143
lifecycle
previous
Product Category
Teradata Vantage™

Represents a variable-length binary string.

Syntax

VARBYTE ( n ) [ attributes [...] ]
n
The number of bytes in the string.
The maximum value for n is 64000.
attributes
Appropriate data type, column storage, or column constraint attributes.
See Core Data Type Attributes and Storage and Constraint Attributes for specific information.

ANSI Compliance

VARBYTE is a Teradata extension to the ANSI SQL:2011 standard.

External Representation of VARBYTE

The following table lists the client representations for the Teradata SQL VARBYTE data type.

Define the length of the VARBYTE string as k, where 0 ≤ k ≤ n.

Client CPU Architecture Client Internal Data Format
IBM mainframe k + 2 bytes 16-bit SMALLINT (2 byte) length count k followed by k bytes of BYTE data.
  • UTS
  • RISC
  • Motorola 68000
  • WE 32000
  • Intel
k + 2 bytes 16-bit SMALLINT (2 byte) length count k followed by k bytes of BYTE data.

Example: VARBYTE Data Type

In the following example, the column named BinaryData is assigned the VARBYTE data type and has an upper limit of 1200 bytes:

CREATE TABLE DocTable
  (DocType INTEGER
  ,DocName CHAR(26)
  ,BinaryData VARBYTE(1200));