SQL Server的XML问题中的Undeclare前缀

时间:2015-10-07 16:47:01

标签: xml-parsing

我目前正在尝试使用以下代码将xml节点插入到SQL Server中的表字段中。我试图在插入中声明命名空间但我继续得到未声明的前缀。我究竟做错了什么?

代码:

Declare @Term XML = '<wma:Term>My First Term</wma:Term>'
Declare @x XML 
Select @x = MetaData from [Products] where Id = 1
Set @x.modify ('declare namespace wma="http://www.google.com/wma"; insert     sql:variable("@Term") as last into (/wma:WMA/wma:List)[1]

预期结果:

 <wma:WMA xmlns:wma="http://www.google.com/wma">
      <wma:List>
        <wma:Term>My First Term</wma:Term>
      </wma:List>
    </wma:WMA>

0 个答案:

没有答案