I need help parsing a dynamic string(see below). This string can change to only have one set of values to two, to three(like the one below).
Raw String:
valueA=valueB=valueC=valueD==valueE&valueA=valueB=valueC=valueD==valueE&valueA=valueB=valueC=valueD==valueE
End Result: VelueB, ValueB, ValueB
I have been able to extract valueA
using the STUFF
and CHARINDEX
function(see below) but I'm having difficulty just getting valueB
. I have also tried doing it in ssrs using the split function but getting nowhere.
STUFF(( SELECT ',' + ' ' + SUBSTRING(param, 1,
CHARINDEX('=', param) - 1)
FROM dbo.Fn_mvparam(column_a, '&') AS fm
FOR
XML PATH('')
), 1, 1, ' ')
This should do it:
This should do the trick for you. Hope its useful to you
Usage:
Scenario Answer: