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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Can you round a decimal in a sproc?

Author  Topic 

rlull
Starting Member

39 Posts

Posted - 2006-08-03 : 11:15:40
I am using the following code in a sproc:

CREATE PROCEDURE GetOrderItemsPlusDiscount
(@OrderID int)
As
select OrderItems.*, (BasePrice * ((100 - ItemDiscount) * 0.01)) * Qty As Subtotal
from OrderItems
where OrderID = @OrderID
order by ProdName
GO

I want to round the number that is returned as Subtotal to two decimal places, for example: 20.34 as opposed to 23.343 is this possible from within the sproc?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-08-03 : 11:21:17
[code] select OrderItems.*, convert(decimal(12,2), (BasePrice * ((100 - ItemDiscount) * 0.01)) * Qty) As Subtotal
from OrderItems
where OrderID = @OrderID
order by ProdName[/code]


KH

Go to Top of Page
   

- Advertisement -