Decoding and Filtering Months


Decoding and Filtering Months


A relatively new user of teradata. I need to filter out some specific months from a table.

But the Month-IDs are such 1310 or 1286 such four digit numbers. How to extract exact month and year info from these?

( I learnt that teradat saves date in (year-1900)*10000+ Month*100. But that will be 7 digits, here in my case it is only 4 digit).

Thank you
Junior Contributor

Re: Decoding and Filtering Months

What's the meaning of month 1310? Looks like the number of months since 1900-01-01?

SELECT ADD_MONTHS(DATE '1900-01-01' , 1310) returns 2009-03-01

You might check the month_of_calendar column in sys_calendar.calendar, too.


Re: Decoding and Filtering Months

Thanks a lot Dieter !

I used this logic, and it seems to be the case. Thanks again