File Name

  • I have a table called Log which keeps the log for all the files uploaded to the database.

    In it, there is a column called FILES, which retained all the files processed as well as their location, for example, e:\uploaded\vendorA.txt. How can I code so that I got only the name of the file vendora.txt.

    Thanks,

    QJLEE

  • A couple hints,

    use reverse, then charindex to find the "\" and then substring.

  • Can you please be more specific?

    Thanks,

  • QQ-485619 (12/19/2009)


    Can you please be more specific?

    Thanks,

    Yes, but then you'd miss out on all the fun. 😉 Did you lookup REVERSE in Books Online? Also lookup CHARINDEX which will also be necessary.

    This is a simple problem and 15 minutes of effort on your part will likely produce the results you want and you'll learn something new in the process so you won't have to ask the same question next time. 😀

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

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

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