• palotaiarpad (10/24/2012)


    Lets play a bit:

    Select cast(100 as real) * 1.05,cast(cast(100 as real) * 1.05 as int);

    -- Result is 105, 104

    The result is very strange for me. Does SQL Server the calculation from inside to outside or not? :w00t:

    ...change the second "real" to "numeric" it gives same as 105...

    (as it says in BOL "Approximate-number data types for use with floating point numeric data. Floating point data is approximate; therefore, not all values in the data type range can be represented exactly. ")

    ww; Raghu
    --
    The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.