Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 29 Jan 2008 @ 18:13:25 GMT


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


Subj:   Re: Convert time from twenty four hour to twelve hour format
 
From:   Pugliesi, Anthony J

The data going into the format statement is not in the correct form. You will get the same error if you run this:

     sel extract(month from current_timestamp) (format '99')
     , cast(extract(month from current_timestamp)
           as char(2) ) (format '99') charmonth

The second column errors out because the cast statement has changed the number produced by the extract to characters yielding '1 ' if executed today. Remove the format statement from the second column and the statement executes. By the way the format statement does NOT produce the same results, at least visually, in SQL Assistant as it does in BTEQ. However I believe you will get the same error in BTEQ.

You will probably need to do something a little more complicated than a simple format and cast to arrive at you solution.


Good luck,

Tony



     
  <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