|
A 或示例 B 中描述的过程相似。
SELECT 1 as Tag, NULL as Parent, Customers.CustomerID as [Customer!1!CustomerID], Customers.ContactName as [Customer!1!ContactName!element] FROM Customers ORDER BY [Customer!1!CustomerID] FOR XML EXPLICIT GO -- set the value back to original UPDATE Customers SET ContactName='Maria Anders' WHERE ContactName='Mar<ia Anders' GO
下面显示部分结果。因为在查询中指定了 element 命令,所以指定的特性名是包含元素的名称。也
对 ContactName 进行实体编码(将 ContactName 中的 < 字符返回为 <)
<Customer CustomerID="ALFKI"> <ContactName>Mar<ia Anders</ContactName> </Customer> <Customer CustomerID="ANATR"> <ContactName>Ana Trujillo</ContactName> </Customer> 上一篇:ETL工具点评 下一篇:MSSQL 使用 EXPLICIT 模式二 |