Teradata has many date and time functions, but sometimes they are not too intuitive. If you need to calculate the first and last date for the current month as part of a batch program, try this SQL:
SELECT MIN(calendar_date) BOM, MAX(calendar_date) EOM FROM sys_calendar.calendar WHERE (month_of_year , year_of_calendar) IN (SELECT month_of_year, year_of_calendar FROM sys_calendar.calendar WHERE calendar_date = DATE)
No comments:
Post a Comment