|
Archives of the TeradataForumMessage Posted: Mon, 03 Mar 2003 @ 20:49:00 GMT
shivaji wrote:
Only works with BTEQ and it's just for display, the value is still the whole date. You don't have to cast to date, but to char: sel current_date (FORMAT 'MM') (char(2))
ANSI compliant SQL
ODBC SQL, works only with Queryman (when "Allow use of ODBC SQL Extansions in queries" option is set)
ODBC SQL again, use EXTRACT instead sel extract(month from add_months(current_date,-1))
select current_date - extract(day from current_date);
ODBC SQL again, use EXTRACT instead
Again BTEQ only --> sel add_months(current_date,-1)( FORMAT 'YYYYMM') (char(6)) ANSI compliant: sel extract(year from add_months(current_date,-1)) * 100 + extract(month from add_months(current_date,-1));
Your week starts with Saturday? If it's sunday: sel calendar_Date - day_of_week + 1
sel calendar_Date - day_of_week + 1 - 7 from sys_calendar.calendar where calendar_Date = current_date Dieter
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Copyright 2016 - All Rights Reserved | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Last Modified: 15 Jun 2023 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||