Dear All, Need help on the below query. I have pulled this script from postgres database and modifed in sql sever. output in postgres=0.00273785078713210130 output in sql server=0.00273972602739726 the logic is the same as in postgres,not understanding what is the issue in this query please help me the data type for @u and @t in postgres is just numeric,i have taken as float in sql server
IF @u > @t * (365.25/12) BEGIN SELECT @Output=1 END ELSE IF @t <= 0 OR @u <= 0 BEGIN SELECT @Output=0 END ELSE IF (@d = 'N' and @t < 85) or (@d = 'U' and @t <61) BEGIN
SELECT @Output = (earnlo + (earnhi - earnlo) * ( @u - expdayslo) / (expdayshi - expdayslo) ) FROM rm_vscearn WHERE @u BETWEEN expdayslo AND expdayshi AND @t BETWEEN termlo AND termhi AND @d = newused
END ELSE BEGIN SELECT @Output = @u/(@t * (365.25/12)) END
the result will be corrected to highest significant figure among operands. so check the values of fields involved in the calculation and see if they've required precision and scale.
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
the result will be corrected to highest significant figure among operands. so check the values of fields involved in the calculation and see if they've required precision and scale.
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
Thanks for the reply. all the fields involved in the calculation have integer values,they don't have any decimal value in the table. so,how do i achieve the required output.