Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple rounding help.

Status
Not open for further replies.

kingstonr

Programmer
Dec 5, 2005
26
US
hi,
i am gettung value as 14493.48000000000
I want to round to 2 decimals and take upto only 3 decimals.i need 14493.480
when i use round
select round(14493.48000000000,3)
i am getting 14493.48000000000.Can anybody help me how to
remove values other than 3 decimals.
I want 14493.480

Thanks
kingston
 
select Convert(Decimal(10,3), round(14493.48000000000,3))

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
George,

kingstonr said:
I want to round to 2 decimals and take upto only 3 decimals.i need 14493.480

You suggested:
[tt]select Convert(Decimal(10,3), round(14493.48000000000,3))[/tt]

which does work with the original figure but not with, for example [tt]14493.48123456789[/tt], wouldn't:
[tt]select Convert(Decimal(10,3), round(14493.48000000000,2))[/tt] be better?


Hope this helps.



[vampire][bat]
 
True enough. I did seem to miss that point.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top