• autoexcrement (5/24/2014)


    For anyone else following along, I just thought I'd mention however that I omitted SalesRepID from my index and from my case statements on eligibility. My index and row_number, etc. were done on CustID, SaleDate.

    😀

    I'm not sure which index is "my index" above and, apologies, I don't have the time to go back through this post but I want to make sure that you understand that if SalesRepID is one of the columns that you're relying on for the proper order of the QU, it needs to be included in the clustered index that the QU uses.

    --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)