• Christian Buettner-167247 (12/14/2009)


    Hi Honza,

    I know it's not documented - I just would like to know if someone knows what is going on behind the scenes. I am just curious. My question was not meant to be a challenge for your QotD.

    But with regards to your question

    Is it OK to order on missing column?

    It "might" be OK, since SQL Server is not generating an error.

    But it might as well be not OK (to which I tend more)

    But take the "unsupported" SET statement from your QotD - is it OK to use it as it is? From a SQL standpoint it should not be valid, but obviously it seems to work and you can do some useful stuff with it.

    Now don't ask me for what you could use the positioned order by in my example - actually i just misread your example and exchanged the I with a 1 accidentially. Took me a while to figure out what I had done wrong...

    I don't know what is going on behind the scenes.

    Sometimes I do some type of mental reverse engineering, just trying "How do I programme this".

    This additive assignment to local variables I feel to be an implicit cursor. I suppose the server creates something like a cursor and makes an assignment in it. I haven't compared yet the efficiency of these two variants (single select assignment and cursor). At least it is less coding.



    See, understand, learn, try, use efficient
    © Dr.Plch