Hi @Lewis Corcoran I'm not an expert on XML. Can this thread help you? https://stackoverflow.com/questions/10875577/how-do-you-keep-html-tags-when-querying-a-xml-using-sql Best regards, Percy Tang
How to keep HTML tags in FOR XML query
I need to upload a XML file with HTML code within it.
I use the FOR XML PATH at the end of the query, the table has the relevant <p> <p>
and </p>
tags, but when i click on my result these have been converted to their Unicode values as <
and >
How do i export these as the raw tags as %lt;
is being recognised as the character < and > and not the <p> </p>
tag
SQL Server | Other
3 answers
Sort by: Most helpful
-
-
Deleted
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more
-
Olaf Helper 47,436 Reputation points
2023-04-13T06:23:26.8466667+00:00 HTML is nothing else then XML with predefined tags. You can not have XML code within XML code. The only way is to use a CDATA element: https://learn.microsoft.com/en-us/sql/relational-databases/xml/example-specifying-the-cdata-directive?view=sql-server-ver16