• In case you're simply having google-fu failure, here's the link explaining the code:

    http://msdn.microsoft.com/en-us/library/ms186734.aspx

    MSDN article on ROW_NUMBER().

    OVER is a keyword to tell it you're about to tell it your intentions, that's all.

    PARTITION BY is when it starts to renumber. Think of a group by. It'll give you a different row_number() for each row with the same value, then restart at 1 for the next value. ORDER BY simply tells it what order to apply the 1,2,3,4,5... into.

    There is no alternative to using that windows funtion. It's rather powerful and very effective for the cases where it's needed.

    The question is what's the rest of the query that it's used in?


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA