String to Date

TO_DATE converts a date represented in a character string to a DATE data type.

The second argument is a format string that indicates how the character string should be parsed to create the date value.

Syntax: TO_DATE(string, format)

The following can be modified for any datetime separators (such as ‘-‘, ‘/’, or ‘:’):

Date as inputFunction Call
2017/02/08TO_DATE(date, 'YYYY/MM/DD')
08/02/2017TO_DATE(date, 'DD/MM/YYYY')
08-02-2017TO_DATE(date, ‘DD-MM-YYYY’’)
02082017TO_DATE(date', 'MMDDYY')
08 Feb 2017TO_DATE(date, 'DD MM YYYY')
18:45:09TO_DATE(date, 'HH24:MI:SS')


String to Number

Number as inputFunction call
5CAST(number AS integer)

or alternatively number::integer

or alternatively

convert(integer, number)

2.3CAST(number AS decimal(1,1))

It is important to specify correctly the precision you want. For example, for input 2.33 you should choose CAST(number AS decimal(1,2)).

in SQL Playbook