Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 02 Oct 2003 @ 12:50:37 GMT


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


Subj:   Re: BTEQ Export Syntax
 
From:   Geoffrey Rommel

  How do I format:  


  a Date field as Char (8), Format 'yyyymmdd'  


  a Decimal (10.2) field as Char (12), Format '-9(8).99'  



The trick here is to remember that changing the format of a field does not change its data type. If you want a numeric field to come out as a formatted character string, you must change both its format and its data type, like so:

cast(cast(date_field as format 'yyyymmdd') as char(8))

cast(cast(decimal_field as format '-9(8).99') as char(12))


The above applies to .export data. If you are using .export report, you may be able to get away with changing only the format.



     
  <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