How to extract "My Report" from the String /MY Reports/LotusNotes Ok/My English Report

  • Hi Everyone,

    I am stuck with this problem. I want to extract the word between the first two "/" i.e. "My Report" from this String /MY Reports/LotusNotes Ok/My English Report.

    I will greatly appriciate if someone could help me with this one.

    thanks

  • if the path will be less than 4 folders deep, you could use a trick with PARSENAME:

    /*

    (No column name)(No column name)(No column name)(No column name)

    NULLMY ReportsLotusNotes OkMy English Report

    */

    SELECT

    PARSENAME(ThePath,4),

    PARSENAME(ThePath,3),

    PARSENAME(ThePath,2),

    PARSENAME(ThePath,1)

    FROM

    ( SELECT REPLACE('/MY Reports/LotusNotes Ok/My English Report','/','.') AS ThePath) X

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

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

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