When 2 decimal(30,10) numbers are divided in Sql Server 05, 2 last decimals seem to be getting lost (not even rounded off, simply truncated).
For example:
Declare @x decimal(30,10)
Declare @y decimal(30,10)
Declare @z decimal(30,10)
select @x = 2.1277164747
select @y = 4.8553794574
Select @z = @y/@x
select @z
Result: 2.28196731**00**
But if 2 numbers being divided are converted to float that seems to work:
....
Select @z = cast(@y as float)/cast(@x as float)
select @z
Result: 2.28196731**81**
Why is Sql doing this? And what's the right way of dividing decimals without loosing precision in Sql.