Select only specific patterns from a SQL column
I have a need to select only a specific pattern from a SQL column. Its an
XML type column, however its not formatted as XML. Here's an example of
what might be contained in the column:
taSopDistribution
i 3
s W-13-I73516502
:d:
i 7
:d:
:d:
s 60-99-9999-99-20950-00
m 0
m 5.8800
s W-13
:d:
:d:
:d:
:d:
:d:
:d:
s 60-99-9999-00-60950-00
I need to be able to query this field and select only the pieces of data
that follow this pattern: ##-##-####-##-#####-##, and there will be
multiple matches.
For example, I need a query that returns the following values from the
example data field above:
60-99-9999-99-20950-00
60-99-9999-00-60950-00
Any help on this would be greatly appreciated! FYI, I'm using SQL Server 2012
No comments:
Post a Comment