Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 17 Jul 2009 @ 10:27:29 GMT


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


Subj:   Re: Rounding up values in terdata
 
From:   Mohd Suhail

  For example: i have 0.15672 and I need to round it up to 1 Similarly I have 2.1243 and I have to round it upto 3 Similary 2.34 to 3 and 4.0123 to 4  


Why do you want the result for 4.0123 as "4" and not "5". With the other examples you provided, it seems that you always want to round up. If that is what you want to do then this sql should work:

Casting as integer truncates the decimal portion and provides the integral value.

select cast( as integer)+1 should do

eg:

     select cast(0.15672 as integer)+1;

     select cast(2.1243 as integer)+1;

     select cast(2.34 as integer)+1;

     select cast(4.0123 as integer)+1;(will give result "5" and not "4")

Regards,

Suhail



     
  <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