I want to keep html tags in my sql query when i write a query to generate xml tags.
For example:
select '<p> this is a code</p>' as code
from table name
for xml path (''), type
outputs:
<code><p> this is a code </p> <code>
what it should output:
<code><p> this is a code </p><code>
How do I solve this? Thanks!
If using
xhtml, I believe the conversion toXmlwill do:EDIT: if the column is
ntext, implicit conversion toXmlis supported: