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 2005 Forums
 Transact-SQL (2005)
 multiplying money data type

Author  Topic 

helixpoint
Constraint Violating Yak Guru

291 Posts

Posted - 2009-04-15 : 10:40:32
The value is not correct when I multiply it

OrderDetail.Subtotal * .15 AS payout
81.5100 * .15 = 12.000000

It should be 12.2265 (12.23)

SELECT models.merchantAccountNo, OrderDetail.Subtotal + Orders.ShippingCost AS total, Orders.OrderID, models.modelID, '' AS description,
OrderDetail.Subtotal * .15 AS payout
FROM Orders INNER JOIN
OrderDetail ON Orders.OrderID = OrderDetail.OrderID INNER JOIN
PSet ON OrderDetail.pantiesSetID = PSet.pantiesSetID INNER JOIN
models ON PSet.modelID = models.modelID
WHERE (Orders.isPayed = 0) AND (Orders.Canceled = 0)

Dave
Helixpoint Web Development
http://www.helixpoint.com

karthik_padbanaban
Constraint Violating Yak Guru

263 Posts

Posted - 2009-04-15 : 10:55:42
check this its working fine for me.

declare @a table (id int, mon money)
insert into @a select 1,81.5100
select mon *.15 as payout from @a

result
12.226500

Karthik
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-04-15 : 13:59:47
are you sure the datatype of field OrderDetail.Subtotal is money though it stores money values?
Go to Top of Page
   

- Advertisement -