可能是一个没有答复的副本.
SQL Server 2008 – Add XML Declaration to XML Output
SQL Server 2008 – Add XML Declaration to XML Output
请让我知道,如果这是可能的.我读了一些博客
http://forums.asp.net/t/1455808.aspx/1
http://www.devnewsgroups.net/group/microsoft.public.sqlserver.xml/topic60022.aspx
但是我不明白为什么我不能这样做.
你必须手动添加它. sql Server始终将xml内部存储为ucs-2,因此sql不可能生成一个utf-8编码头
原文链接:https://www.f2er.com/xml/292949.html请参阅MSDN上的“Limitations of the xml Data Type”
The XML declaration PI,for example,
<?xml version='1.0'?>
,is not preserved when storing XML data in an xml data type instance. This is by design. The XML declaration (<?xml ... ?>
) and its attributes (version/encoding/stand-alone) are lost after data is converted to type xml. The XML declaration is treated as a directive to the XML parser. The XML data is stored internally as ucs-2.