How can i extract month from a date in the MMM format.example 01-31-2008 I need to get an output 'JAN'can we do this with out using case statement?Thanks
select current_date (format 'MMM'); *** Query completed. One row found. One column returned. *** Total elapsed time was 1 second.Date---- Jan
jim,i tried it and i was still getting the date 01/04/2007has it got anything to do with the database settings or the teradata versionwe are currently using v2r5 and i issues this sql on queryman.Thanks
My previous suggestion only works in BTEQ. Normally, output formatting is controlled by the client program, but you can use the CAST operator to force the Teradata server do the conversion.For example:sel cast ((cast(current_date as format 'mmm')) as char(3));
Thank you very much JIM.
Yes,Bteq and SQL assistant may have different result of the same sql,Just because bteq use CLI and SQL Assistant use odbc, but if you use sql for etl, you'd better try sqls in bteq
In SQL Assistant we can use:
SELECT Current_Date(FORMAT 'MMM') (CHAR(3)) AS MonthName
This is also available.
SELECT TO_CHAR(CURRENT_DATE, 'Mon');