SNT
SNT

Reputation: 1433

Convert varchar(20) into date format Teradata SQL

I have a column months which is a varchar(20) . How can I convert it to a date format . I did try this

select CAST(month as DATE FORMAT'dd.mm.yyyy') from TABLE_123

For which I get an error invalid date supplied for TABLE_123.

Thank you.

month
12
11
1
3
6
6

Upvotes: 0

Views: 1832

Answers (1)

select CAST(month as DATE FORMAT'dd.mm.yyyy') from TABLE_123

According to my understanding the format of input string should be same as 'dd.mm.yyyy' while casting as date and your input sample shows that it does not satisfy that necessary condition.

Please correct me if I'm wrong.

Upvotes: 2

Related Questions