• Luis Cazares (8/1/2013)


    Hi George,

    You should really be trying to figure out this yourself by using BooksOnLine (BOL or SQL Server help) but I'll try to explain.

    REVERSE will do exactly what it says, returns the reverse order of a string value.

    I use it because I need to find the last space in the string. As CHARINDEX won't have a backwards function, I need to reverse the string to get the last space that will become the first one. Was I clear or did I confuse you even more? 😛

    To add to that, especially since George is a newbie...

    @george, just in case you don't know (a lot of newbies don't), "Books Online" is the "help" documentation that comes with SQL Server. You can easily get there by pressing the {f1} key from SSMS (SQL Server Management Studio).

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