How To get Characters after a string

  • Hi All

    I need to select the document file extention but I'm not getting the same results if the fileName has more that one dot "."

    e.g

    C:\Documents and Settingskiewiedo001\Desktopatalie Cv.doc = doc --Which is the results I want

    and

    C:\Documents and Settings\HRTemp001.ZADBNHRW1\Desktop\cv.doc = ZADBNHRW1\Desktop\cv.doc --starting after the first "."

    How do I get just the file extension using the query below?:

    Select CVFileName

    ,RIGHT(CVFileName, len(CVFileName) - charindex('.', CVFileName))

    From CandCV

    Thanks.

    Teee

  • Something like this..

    SELECTCVFileName

    ,RIGHT(CVFileName,CHARINDEX('.',REVERSE(CVFileName),0)-1)

    FROMCandCV


    Kingston Dhasian

    How to post data/code on a forum to get the best help - Jeff Moden
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • Thank you so much, it works perfectly 🙂

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply