TRYCAST | Data Types and Literals | Teradata Vantage - TRYCAST - 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ā„¢

TRYCAST takes a string and tries to cast it to a data type specified after the AS keyword (similar to CAST). If the conversion fails, TRYCAST returns a NULL instead of failing.

Syntax

TRYCAST ( instring AS data_type )
instring
A CHAR or VARCHAR expression in the LATIN or UNICODE character set.
data_type
One of the following supported data types:
  • BYTEINT
  • SMALLINT
  • INT
  • BIGINT
  • FLOAT
  • DECIMAL
  • NUMBER
  • CHAR (LATIN or UNICODE)
  • VARCHAR (LATIN or UNICODE)
  • DATE
  • TIME (with zone)
  • TIMESTAMP (with zone)
  • All INTERVAL types