I have teradata scripts
AND ADD_MONTHS('?StartDate',1)-1 BETWEEN A.CNTSTRT_DT AND COALESCE(A.CNTEND_DT, DATE) This script looks like it prompts for a date, then adds one month to that date. But I'm not clear on what the -1 does.
Additionally, I see that it compares the date to see if they are between the CNTSTRT_DT and CNTEND_DT, but what does the DATE do specifically?
31 Answer
The -1 is to substruct one day, for example the query:
select ADD_MONTHS(cast('2016/01/25' as date),1)-1 returns: 24/02/2016
Also, "Date" is a function which returns current date.
0