dbTalk Databases Forums  

Update function without rounding up

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss Update function without rounding up in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Vanny
 
Posts: n/a

Default Update function without rounding up - 01-08-2010 , 05:33 PM






I need to update a field defined as numeric (6,2) from another field defined
as integer within a table. I use the statement like this:

Update table1
Set Hourly=convert(decimal(10,2),Salary)/2080

For example if Salary=37953, after update the system automatically round the
Hourly to18.25. Since 37953/2080=18.2466.., what is the statement I should
use to get 18.24 by not having the system rounding up.

Please help this is urgent.

Vanny

Reply With Quote
  #2  
Old   
Nick Elson [Sybase iAnywhere]
 
Posts: n/a

Default Re: Update function without rounding up - 01-08-2010 , 07:11 PM






Check out the TRUNCNUM( ) built in funtion.


"Vanny" <lim_v (AT) bls (DOT) govSPAM_BE_GONE> wrote

Quote:
I need to update a field defined as numeric (6,2) from another field
defined as integer within a table. I use the statement like this:

Update table1
Set Hourly=convert(decimal(10,2),Salary)/2080

For example if Salary=37953, after update the system automatically round
the Hourly to18.25. Since 37953/2080=18.2466.., what is the statement I
should use to get 18.24 by not having the system rounding up.

Please help this is urgent.

Vanny






Reply With Quote
  #3  
Old   
Vanny
 
Posts: n/a

Default Re: Update function without rounding up - 01-11-2010 , 07:48 AM



Thank you very much. It works.

"Nick Elson [Sybase iAnywhere]" <@nick@dot@elson@at@sybase@dot@com@> wrote
in message news:4b47c9bb (AT) forums-1-dub (DOT) ..
Quote:
Check out the TRUNCNUM( ) built in funtion.


"Vanny" <lim_v (AT) bls (DOT) govSPAM_BE_GONE> wrote in message
news:4b47b2d1$1 (AT) forums-1-dub (DOT) ..
I need to update a field defined as numeric (6,2) from another field
defined as integer within a table. I use the statement like this:

Update table1
Set Hourly=convert(decimal(10,2),Salary)/2080

For example if Salary=37953, after update the system automatically round
the Hourly to18.25. Since 37953/2080=18.2466.., what is the statement I
should use to get 18.24 by not having the system rounding up.

Please help this is urgent.

Vanny







Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.