CAST in Teradata

Data can be converted from one type to another by using the CAST function.

Syntax:
SELECT CAST(column AS datatype[length])
FROM table;


Example:
SEL 
CAST('SSSS' AS CHAR(2)) AS truncation,
CAST(333 AS CHAR(3)) AS num_to_char,
CAST(122 AS INTEGER) AS Bigger,
CAST(111.44 AS SMALLINT) AS whole_num,
CAST(178.66 AS DECIMAL(3,0)) AS rounding;


Output:
truncationnum_to_charBiggerwhole_numrounding
SS333122111179