Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 19 Jul 2006 @ 15:11:24 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: How to change date formats in views?
 
From:   Geoffrey Rommel

  I have a view which is built over the system calendar view. I need the date format to be changed to be displayed with 'mmmYY' format. But the format phrase does not work if the underlying table or view is of a different format.  


It does work, but ...

In BTEQ, the data will appear as you wish, because BTEQ extracts data in Field Mode. In this mode, the engine turns every field into a character string, including the requested format, and that's what BTEQ displays.

Most other applications, including SQL Assistant, use Record Mode, in which the entire row is returned in an internal form; the format is therefore irrelevant. The application then applies its own formatting. (In SQLA 7.1, this is 'mm/dd/yyyy', but I think that will be configurable in the near future.)

To get around this, you can cast the field as character before it comes back to the application, thus:

     cast(cast(calendar_date as format 'mmmYY') as char(5))


     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023