• julian.fletcher - Monday, July 16, 2018 8:43 AM

    The "it" was the suggested solution:
    SELECT TOP 5 PERCENT *
    FROM Data.SalesByCountry
    ORDER BY NEWID()

    The table is already there - the task was to retrieve some records randomly.

    In that case, I totally agree! 😀

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