While trying a small piece of code. I've happened to face a problem with division by any value on an integer is returning zero.
Tried changing the destination value as decimal but still no effect.
print @PrevEff print @PrevCost print @PrevUsefulCost
print @CurrEff
declare @finalcost decimal(10,2)
set @finalcost = @PrevEff / @PrevUsefulCost
print @finalcost
----------The above statements provided 0 as the output.....
Now, I've tried changing the manipulation part as Casting to float and process it... OOPS... it's working like a charm.....
print @PrevEff print @PrevCost print @PrevUsefulCost
print @CurrEff
declare @finalcost decimal(10,2)
set @finalcost = CAST(@PrevEff AS float) / CAST(@PrevUsefulCost AS float)
print @finalcost
Cheers,
Venkatesan Prabu .J
very nice post
ReplyDeletedbakings