String to Date and Timestamp

The CONVERT function converts an expression of one data type to another. Its syntax is :

CONVERT(target_data_type(length),expression,style)

Date as input Function call
02/08/17 CONVERT(varchar,date,101)
17.02.08 CONVERT(varchar,date,102)
08/02/17 CONVERT(varchar,date,103)
08.02.17 CONVERT(varchar,date,104)
08-02-17 CONVERT(varchar,date,105)
08 02 17 CONVERT(varchar,date,106)
February 08, 17 CONVERT(varchar,date,107)
10:59:00 CONVERT(varchar,date,108)
February 08 2017, 10:59:00AM(or PM) CONVERT(varchar,date,109)
02-08-2017 CONVERT(varchar,date,110)
17/02/08 CONVERT(varchar,date,111)
170208 CONVERT(varchar,date,12)
20170208 CONVERT(varchar,date,112)
08 02 2017 10:59:00 (in 24h) CONVERT(varchar,date,113)

 

String to Numeric

For conversion from string to numeric data you can use the cast function with the following syntax:

Number as input Function call
5 CAST(number AS int)
2.3 CAST(number AS float)

 

in SQL Playbook