How to extract values from a column which has multiple delimiters?

  • I put the data you provided into a table and ran the code I posted and it worked.

    If it is failing for you, you are going to have to provide more information.

  • This is a different option using Pattern Splitting (using Lynn's sample data).

    select

    *

    from dbo.TestData td

    cross apply (select stuff((select ',' + ca.Item

    from dbo.PatternSplitCM(td.TestValue,'%[0-9]%') ca

    where ca.Matched = 1

    for xml path(''),TYPE).value('.','nvarchar(max)'),1,1,'')) ca3(IDs)

    The function and explanation can be found in here:

    http://www.sqlservercentral.com/articles/String+Manipulation/94365/

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 2 posts - 16 through 17 (of 17 total)

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