• Last comment, and then I'll shut up (for now)

    Open Minded (8/26/2010)


    isn't it possible to use approximation if one is not specific of the exact value of the approximation, like "less than" and "greater than" ?

    Yes. A test of "IF @float > 1.0" is okay.

    And if you really have to test for equality with floating point data, you have to consider how many of the decimals are relevant and then round: "IF ROUND(@float, 3) = 1.000" should work. If you change the WHILE in this question to "while round(@1,3) <> 1", the code finishes and returns a single value.


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/