• robert-695083 (4/6/2010)


    Seems you cant use Order By new() in a function unless it is in Dynamic sql. And the only way I could find to use it was in openrowset...Any other idea?

    You can trick it, though. Create a view with nothing in it but SELECT NEWID() AS SomeNewID and you can call the view from the function.

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