Archives of the TeradataForum
Message Posted: Thu, 23 Aug 2012 @ 09:36:18 GMT
As I understand, the input field must be a character , since '2012-30-30' is not allowed in a date field.
What I would do is selecting a subset of SYS_CALENDAR.CALENDAR and typecasting the date to CHAR in order to do the comparisons.
If your table was called TEST_TABLE with a character(10) TEST_DATE field, I'd do something like this.
Select TEST_DATE, calendar_date From TEST_TABLE Left Join ( Select calendar_date (Date, Format 'yyyy-mm-dd') (Char(10)) txt_date, calendar_date From SYS_CALENDAR.CALENDAR Where calendar_date Between '1950-01-01' And Add_Months(Date,5*12) ) On TEST_DATE=txt_date ;
Carlos Carpio Garcia
|Copyright 2016 - All Rights Reserved|
|Last Modified: 28 Jun 2020|