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

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.

The result of the conversion is returned unless there is an error, in which case a NULL is returned. The result data type is whatever data type was specified by the data_type input.

Syntax

TRYCAST ( instring AS data_type )

Syntax Elements

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