Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 17 Jan 2012 @ 23:09:20 GMT


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


Subj:   Re: How to CAST a number without getting a decimal point.
 
From:   Mankala, Mahesh

Numeric to Numeric Conversion

     SELECT CAST (50500.75 AS INTEGER);
     Result: 50500  (truncated),

     SELECT CAST (50500.75 AS DEC (6,0));
     Result: 50501.  (rounded).

When you cast from a decimal to an integer, the system discards everything to the right of the decimal point. In our example, even though the decimal portion was .75, making the number closer to 50501 than to 50500, the result of the cast is still 50500.


Thanks,

Mahesh



     
  <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