I have this example of script for deserialization of an xml, but I'm getting a weird description from it (attached)
How can I write this to get Atom cloth - Black/grey
- which is the right deserialization?
Thank you
declare @x xml
set @x = '<options>
<option>
<code>99248</code>
<description>Atom&#32;cloth&#32;&#45;&#32;Black&#47;grey</description>
<monthlycost>0.00</monthlycost>
<allowed />
</option>
<option>
<code>99239</code>
<description>Metallic&#32;&#45;&#32;Sargasso&#32;blue</description>
<monthlycost>12.85</monthlycost>
<allowed />
</option>
</options>'
select
pref.value('(code/text())[1]', 'varchar(32)') as Code
,pref.value('(description/text())[1]', 'varchar(80)') as [Description]
,pref.value('(monthlycost/text())[1]', 'varchar(32)') as MontlyCost
from
@X.nodes('/options/option') AS Options(pref)