How to extract characters between repeating /

  • I have been searching for a solution and so far I have come up empty with what I am trying to do. I have the following strings:

    Pricing/TiX Reports/valid tix quotes.rdl

    Customer Service/Trianim Web CC Number.rdl

    What I need to do is convert the string in to 2 or 3 new columns depending on the number of /. For example, the first string which is in 1 columns would need to be separated in to 3 columns and the second 2 columns

    Pricing/TiX Reports/valid tix quotes.rdl Pricing TiX Reports Valid tix quotes.rdl

    Customer Service/Trianim Web CC Number.rdl Customer Service Trianim Web CC Number.rdl

    For the instances with a single /, I can handle those using SUBSTRING and CHARINDEX, but my problem comes up in the situation where there are two /'s. Any thoughts on how to extract the data I need?

  • You could try using one of the many "udf_Split" type functions that are freely available on the net, prob on here, and then once the string is split into rows (based on / as the delim) you could then pivot the rows back into columns? Worth a try...not sure how well this would perform mind

  • noticed this string split function in a number of peoples signatures, maybe will help

    http://www.sqlservercentral.com/articles/Tally+Table/72993/

  • Thank you very much! I believe this Solution will get me the results I am look for!!

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

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