【发布时间】:2016-04-25 20:29:27
【问题描述】:
我有一个通过 SQL 生成的 XML,其根目录如下所示:
<ArrayOfKeyValueOfstringPunchListCellModel84zsBx89
ns1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
我希望它看起来像这样:
<ArrayOfKeyValueOfstringPunchListCellModel84zsBx89
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
这是我的 SQL 代码:
DECLARE @persons XML = (
SELECT(
blah blah blah
)FOR XML PATH(''), ROOT('ArrayOfKeyValueOfstringPunchListCellModel84zsBx89'))
set @persons.modify('insert ( attribute ns1 {"http://schemas.microsoft.com/2003/10/Serialization/Arrays"}) into (/ArrayOfKeyValueOfstringPunchListCellModel84zsBx89)[1]')
SELECT @persons
它返回第一个根,我如何让它像我展示的第二个根一样返回?
【问题讨论】:
标签: sql sql-server xml tsql xml-namespaces