SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,133 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi there.
I am puzzled by this behavior
SELECT
v.sc as [data()]
FROM (VALUES
('"' , '"')
,('''' , ''')
,('<' , '<')
,('>' , '>')
,('&' , '&')
) v (sc, sce)
FOR XML PATH(''), TYPE
The result: " ' < > &
I am expecting: " ' < > &
Any reason?
How to make it entitize values properly?
Is this a bug?
Thank you.
Have a great day.
Xml does not require single quote to be quoted. XML only require quoting of double quotes when the double quote is in an attribute value.
<root v="this require quoted double quote(")">double quote ok (")<root>