How to change char date format to date format in teradata SQL?

I have a date column date CHAR(7) CHARACTER SET LATIN NOT CASESPECIFIC, where I have some values ​​like 2010-12, 2011-10, etc. I want to change them in the date format yyyy / mm. How should I do it? Thanks

+4
source share
1 answer

Just apply FORMAT executing CAST:

 SELECT CAST('2010-12' AS DATE FORMAT 'YYYY/MM') 

This returns the valid date from the day set on the 1st of this month.

+4
source

Source: https://habr.com/ru/post/1496088/


All Articles