• The reason of your problem is that you're dividing integers and that will return an integer when you want a float or decimal value.

    Check the following examples:

    SELECT 2/100 intDivision,

    2/100.0 floatDivision,

    2/CAST( 100 AS decimal(10,2)) decimalDivision,

    0.02 DirectExpression

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2