• Oleg Netchaev (6/10/2010)


    Very good question, thank you Jason! I answered it correctly because I remembered there was a discussion some time in the past on this site about the read_only nuances of the model database. When the high quality question like this is also combined with Hugo's comments then it is truly enjoyable.

    Until today I was not sure about how them 0.75 points get converted to 0 :hehe:. I thought before that it was because cast(0.75 as int) * @qod_points = 0, but today someone suggested that it is because of floor(0.75) * @qod_points = 0. I tested both in 10 mln iteration loop and both take about same time to execute. Then it hit me that none of the above is used because simple (3/4) * @qod_points just does it because of the implicit conversion to int takes care of it.

    Oleg

    Thanks. It is due to that prior question that I thought of this question. I thought it would be a good idea to run through the entire scenario, step by step as displayed.

    Implicit convert to int must be the case. Much more efficient. Thanks for pointing that out.:w00t::w00t:

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events