Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how do I round the value ?

Author  Topic 

Vaishu
Posting Yak Master

178 Posts

Posted - 2007-08-10 : 04:36:49
Hi

I have datacloum called 'price' (float) and using the below code in my stored procedure

cast(price * 1.175 as decimal(19, 2)) as [item-price]

I am getting the price as (ex1: 23.58, ex2: 114.25, ....etc)

So How do I round the value(price) to (ex1: 23.99, ex2: 114.99)

Advance thanks

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2007-08-10 : 04:43:33
ahhh..... a retailer :)

CAST(CAST(cast(Price * 1.175 as decimal(19, 2)) as INT) + 0.99 AS DECIMAL(19, 2)) as [item-price]


Duane.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-08-10 : 05:29:15
[code]ceiling(cast(price * 1.175 as decimal(19,2))) - 0.01[/code]



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Vaishu
Posting Yak Master

178 Posts

Posted - 2007-08-10 : 07:28:09
Hi

Thanks a lot. It works
Go to Top of Page
   

- Advertisement -