• waxingsatirical (8/25/2016)


    Well what is the "Why"? Why are floats not considered best practice by some?

    I don't know what unnecessary work later is incurred by using floats, but I know of lots that is incurred by using decimals. Such as, resizing columns when data sizes go up or accuracy changes, having to constantly avoid multiplication gotchas which cause tricky-to-spot rounding bugs.

    The main cause is that float is an approximate numeric data type. You can get some unpleasant surprises when trying to do math or retrieving a different value that what you expected to have stored.

    Here's an example: http://www.sqlservercentral.com/Forums/Topic1811927-2799-1.aspx

    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