Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 24 Jan 2008 @ 23:35:41 GMT


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


Subj:   Re: Cast Behavior Between 6.1 and 6.2
 
From:   McCall, Glenn David

  The issue has to do with converting all single digit months to the month with a 0 in front of it.  


I don't believe the way cast works has changed. Here is some output from my 6.1 system (i1 is an integer):

     select i1, cast (i1 as char(2)), cast ((i1 (format '99')) as char(2))
     from t1;

       *** Query completed. 2 rows found. 3 columns returned.
       *** Total elapsed time was 1 second.

        i1  i1  i1
     ----  --  --
         3  3   03
         1  1   01

I'm not sure why the cast would ever put in leading zeros unless you specifically asked for it. Most people don't want leading zero's.

The third clause in my example shows one way of putting in the leading zeros via a cast.

NB: To be safe, you should run the above test in bteq - not Queryman as it *may* format the leading zeros out. An insert/select into another table followed by a select via queryman should be OK.


I hope this helps.

Glenn Mc



     
  <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