• Gav B (6/8/2010)


    Gaby,

    I think you just found a bug I hadn't actually spotted! So glad I was of some help in a round-about way.

    I am not sure why that section is there though, and how it works... That's the explanation I was looking for...?

    I have made some, what I think, are improvements to make the whole thing even more useful but I wouldn't want to post that (crediting you of course) without understanding everything about how this works.

    Regards,

    Gav B.

    I welcome the edits (my TSQL is still woefully inadequate). But also, as I said, the two biggest limitations in this are guaranteeing the SORT BY section runs quickly (i.e. column is indexed) and that dates are stored in a datetime (or now that I think of it, the new SQL 2008 Datetime datatypes) format. One purpose of the print statements is also help to view execution plans and see what will and will not be used in terms of indexes.

    Gaby________________________________________________________________"In theory, theory and practice are the same. In practice, they are not." - Albert Einstein