Professional Documents
Culture Documents
Edition
by Tom Coffing, Michael Larkins and Steve Wilmes
Coffing Data Warehousing. (c) 2006. Copying Prohibited.
TeradataSQLQuickReferenceGuide:SimplicitybyDesign,SecondEdition
Description
INTEGER
-2,147,483,648 to 2,147,483,647
SMALLINT
-32,768 to 32,767
DECIMAL (X,Y)
Same as DECIMAL
FLOAT
<value>10307to<value>10-308
REAL
PRECISION
DOUBLE PRECISION
CHARACTER (X)
DATE
TIME
TIMESTAMP
CHAR (X)
Where: X=1 thru 64000
VARCHAR (X)
CHARACTER VARYING (X)
CHAR VARYING (X)
Where: X=1 thru 64000
Teradata also has its own data types that are acknowledged as Teradata Extensions:
Data Type
Description
BYTEINT
-128 to 127
BYTE (X)
Binary
1 to 64,000 bytes
1 to 64,000 bytes
LONG VARCHAR
64,000 characters (maximum data length) The system only stores the characters
provided, not trailing spaces.)
GRAPHIC (X)
Format Symbols
Formatting symbols are very powerful. These symbols allow the user to control the way data can be inserted into a row and displayed in the
result set. It provides for more predictable result sets.
Page 2 / 3
Reprintedforibm\anilkugu@in.ibm.com,IBM
CoffingDataWarehousing,CoffingPublishing(c)2006,CopyingProhibited
TeradataSQLQuickReferenceGuide:SimplicitybyDesign,SecondEdition
Hint - Man Be sure to keep in mind that the ODBC will ignore formatting, unless you trick it. To see true formatting, the user should use
BTEQ.
Basic Numeric and Character Data Formatting Symbols
Symbol
X or x
9
V or v
Implied decimal point. Aligns data on a decimal value. Primarily used on imported data without actual decimal point.
E or e
Exponential. Aligns the end of the mantissa and the beginning of the exponent.
G or g
Graphic data. Each G represents one logical (double byte- KANJI or Katakana) character. Can repeat value- i.e. GGGGG or G(5).
Fixed or floating dollar sign. Inserts a $ or leaves spaces and moves (floats) over to the first character of a currency value. With the proper keyboard,
additional currency signs are available: Cent, Pound and Yen.
Comma. Inserted where appears in format mask. Used primarily to make large numbers easier to read.
Period. Primary use to align decimal point position. Also used for: dates and comma in some currencies.
Dash character. Inserted where appears in format mask. Used primarily for dates and negative numeric values. Also used for: phone numbers, zip
codes, and social security (USA).
Slash character. Inserted where appears in format mask. Used primarily for dates.
Percent character. Inserted where appears in format mask. Used primarily for display of percentage - i.e. 99% vs. .99
Z or z
Zero-suppressed decimal digit. Holds place for numeric digit displays 1 through 9 and 0, when significant. All leading zeroes (insignificant) are shown
as space since their presence does not change the value of the number being displayed.
B or b
M or m
Month. Allows month to be displayed any where in the date display. When 'MM' is specified, the numeric (01-12) value is available. When 'MMM' is
specified, the three character (JAN-DEC) value is available.
D or d
Day. Allows day to be displayed any where in the date display. When 'DD' is specified, the numeric (01-31) value is available. When 'DDD' is
specified, the three-digit day of the year (001-366) value is available.
Y or y
Year. Allows day to be displayed any where in the date display. The normal 'YY' has been used for many years for the 20th century with the 19YY
assumed. However, since we have moved into the 21st century, it is recommended that the 'YYYY' be used.
SELECT
991001(date) (FORMAT 'Yyddd') AS Fmt_Julian
,991001(date) (FORMAT 'YYYY-mm-dd') AS Fmt_ANSI
,9991001(date) (FORMAT 'yy/mm/dd') AS Fmt_Teradata ;
Page 3 / 3
Reprintedforibm\anilkugu@in.ibm.com,IBM
CoffingDataWarehousing,CoffingPublishing(c)2006,CopyingProhibited