• Were the declarations of @SumA and @SumB supposed to confuse us on this one? I found them to be completely unnecessary.

    Thanks for posting. I have often found SQL calculations that create inconsistent or incorrect results as a misunderstanding of datatype size and rounding issues which can often be fixed by simply calculating in the appropriate order.

    Of course, even the most experienced query writers can miss this sort of thing sometimes. If the calculations are critical, it is usually a good idea to put in some sort of validation check so that if there are problems, they can be found early and corrected quickly.