Teradata Date calculation format issue

58 views Asked by At

I have this date set uploaded from SAS to TD and the date format is like MEDI_START_DT format,'MM/DD/YYYY' And now I want to make a calculation baesed on this column MEDI_START_DT + PDAYSSUP -1 = MEDI_END_DT_PRE but MEDI_END_DT_PRE's format is not a date and I tried cast(MEDI_END_DT_PRE's as date) and it says invalid date. Do you guys have any idea on how to get a date format result after the calculation? Thanks!

enter image description here

1

There are 1 answers

2
Tom On

If you loaded the data from SAS and it was formatted as a DATE in SAS then it should work. You should check if your PDAYSSUP variable got defined as FLOAT in Teradata. Try casting that variable:

select MEDI_START_DT + cast(PDAYSSUP as integer) -1 as MEDI_END_DT_PRE
from ...