Date functions in Teradata

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?

3

1 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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like