Forum Discussion

Doug_Marquardt's avatar
Doug_Marquardt
Copper Contributor
Jul 30, 2022

XML Conversion For Node Text Containing &#38

When I cast a string (which is xml) to the xml data type and the node comments contain &#38 it gets converted to &amp. For example:

Declare @xml xml =
'
<SHOP_INSTRUCTIONS>
Remove &#38; return to stock.
</SHOP_INSTRUCTIONS>
';

Select @xml;

/*
Return This:
<SHOP_INSTRUCTIONS>
Remove &amp; return to stock.
</SHOP_INSTRUCTIONS>
*/

 

I would expect the conversion to be: Remove & return to stock.

Am I getting the correct results, or what am I missing?

 

Thanks.

  • olafhelper's avatar
    olafhelper
    Aug 02, 2022
    See the Wikipedia link I posted, one way is &#38;

Resources