How CAST Differs from Teradata Conversion Syntax - Teradata Vantage - Analytics Database

SQL Data Types and Literals

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2025-11-06
dita:mapPath
uds1628112204571.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
exs1472253032394
lifecycle
latest
Product Category
Teradata Vantageā„¢

The process for the CAST function is as follows:

  1. Convert the numeric value to a character string using the default or specified format for the numeric value.
  2. Trim leading and trailing pad characters.
  3. Extend to the right as required by the target string length.
  4. If truncation of non-pad characters is required to conform to the target string length, report string truncation error.
The CAST operation differs from the Teradata SQL conversion as follows:
  • Results are left justified. Column displays are not aligned.
  • Truncation of significant data generates a string truncation error.

Using Teradata conversion syntax (that is, not using CAST) for explicit conversion of numeric-to-character data requires caution.

The process is as follows:

  1. Convert the numeric value to a character string using the default or specified FORMAT for the numeric value.

    Leading and trailing pad characters are not trimmed.

  2. Extend to the right with pad characters if required, or truncate from the right if required, to conform to the target length specification.

    If non-pad characters are truncated, no string truncation error is reported.