• Shifting gears, I find the formula in Books Online to be inaccurate. The number of rows that it returns varies quite a bit. The following will always return the same number of rows although they will be random. Yeah... it takes longer than the BOL formula but it does return an accurate number of rows in random order. It's also a hell of a lot easier to understand for most people.

    SELECT TOP 2.5 PERCENT * FROM Sales.SalesOrderDetail

    ORDER BY NEWID()

    ;

    And, yeah... I know this is a six year old thread but I'm answering the question from yesterday. 😉

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