有没有办法将这两个替换值与1个更新语句组合在一起?
UPDATE dbo.MyTable SET MyXmlColumn.modify('replace value of (/node/@att1)[1] with "1"') WHERE id = 1 UPDATE dbo.MyTable SET MyXmlColumn.modify('replace value of (/node/@att2)[1] with "2"') WHERE id = 1
http://msdn.microsoft.com/en-US/library/ms190675(v=SQL.90).aspx
我不认为你很幸运,Thx.
我尝试了几种没有快乐的语法变体.例如,显而易见的:
SET MyXmlColumn.modify('...'),MyXmlColumn.modify('...')
收益率:
The column name ‘MyXmlColumn’ is specified more than once in the SET
clause. A column cannot be assigned more than one value in the same
SET clause. Modify the SET clause to make sure that a column is
updated only once. If the SET clause updates columns of a view,then
the column name ‘MyXmlColumn’ may appear twice in the view
definition.
但是对于XML DML空间中的此错误消息没有任何帮助.
底线是Expression1& Expression2必须是单个元素.
即便是最彻底的讨论最终也会绕过它……
http://blogs.msdn.com/b/denisruc/archive/2005/09/19/471562.aspx
抱歉. 原文链接:https://www.f2er.com/xml/292601.html