• Paul White NZ (10/29/2010)


    Super-fast DISTINCT using a recursive CTE:

    Absolutely awesome! What on earth made you look for an alternative to DISTINCT?

    On my 8 year old 1.8GHz P4, here's what I get...

    (43 row(s) affected)

    SQL Server Execution Times:

    CPU time = 2938 ms, elapsed time = 3052 ms.

    (43 row(s) affected)

    SQL Server Execution Times:

    CPU time = 0 ms, elapsed time = 3 ms.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)