Data types

Every column in a table is associated with a name and data type. The data type tells Teradata how much physical storage to set aside for the column, as well as the form in which to store the data.

 

Category Data Type Length(bytes) Range of Values
Binary String BYTE fixed Max 64,000
Binary String VARBYTE Variable Max 64,000
Character String CHAR Fixed Format 1-64,000
Character String VARCHAR Variable 1-64,000
Character String LONG VARCHAR Variable VARCHAR(32000) or VARCHAR(64000) depending on Teradata version
Date/Time DATE default format YYYY-MM-DD Values for this type can range from 0001-01-01 through 9999-12-31.  Stored internally as a numeric value and is displayed in a site-defined format
Date/Time TIME 6 or 8 HHMMSS.nnnnnn or HHMMSS.nnnnnn+HHMM
Date/Time TIMESTAMP 10 or 12 YYMMDDHHMMSS.nnnnnn or YYMMDDHHMMSS.nnnnnn +HHMM
Numeric BYTEINT 1 -128 to +127
Numeric SMALLINT 2 -32768 to +32767
Numeric INTEGER 4 -2,147,483,648 to
+2147,483,647
Numeric BIGINT 8
9,233,372,036,854,775,808 to
+9,233,372,036,854,775,807
Numeric DECIMAL(n,m) The range for precision is 1 through 18.  n is the total number of digits (precision). m is the number of digits to the right of the decimal point (scale).
Numeric NUMERIC 1-16
Numeric FLOAT 64-bit IEEE format Values can range from approximately 2.226 x 10 -308 to 1.797 x 10308
BINARY & LARGE OBJECT BLOB  Binary BLOB(n) where n <= 2097088000 (default)
BINARY & LARGE OBJECT BYTE  Binary BYTE(n) where n <= 64000, default is 1
BINARY & LARGE OBJECT VARBYTE  Binary VARBYTE(n) where n <= 64000, where n needs to be specified
BINARY & LARGE OBJECT GRAPHIC CHARACTER
BINARY & LARGE OBJECT VARGRAPHIC  CHARACTER

Most of the column data types are based on ANSI SQL. The examples of ones that are Teradata Extension
to ANSI SQL are:

  • Byte, Varbyte
  • Byteint
  • Date
  • LONG VARCHAR
  • GRAPHIC, VARGRAPHIC and LONG VARGRAPHIC
  • PERIOD

Leave a Reply

Your email address will not be published. Required fields are marked *