Skip to Content
0
Jul 08, 2009 at 03:04 AM

Store procedure result problem

37 Views

Dear All,

I am trying to use this following sp:

Declare @Dec1 as varchar(20)
declare @Dec2 as varchar(20)
declare @dec1m as money
declare @dec2m as money
declare @a as money
declare @b as money
declare @c as money

set @dec1 = '27.5'
set @dec2 = '5'

set @dec1m = cast(@dec1 as money)
set @dec2m = cast(@dec2 as money)

set @a = 1 - (@dec1m/100)
set @b = 1 - (@dec2m/100)
set @c = 1 - (@a*@b)
set @d = @c*100

the result is only 31.12.

if I calculate manually in the MS. Excel worksheet, the result is 31.125. I can decrease decimal to 31.13.

How to do that in the above SP so that the sp result will be 31.13 ? Pls give advice. I appreciate your answer so much.

TIA.

Rgd,

Steve