3
我想添加一個屬性,如果它不存在。它應該很簡單,但我是XML XPath/XQuery /等的新手,所以請原諒我的無知。SQL Server XML添加屬性如果不存在
我希望能夠通過XML數據並對其進行修改......
ALTER FUNCTION [dbo].[ConvertXmlData](@xmlData XML)
RETURNS XML
AS
BEGIN
RETURN @xmlData.<something here>
END
如果我通過類似的數據:
<something>
this is sample data <xxx id="1"/> and <xxx id="2" runat="server" />. More <yyy id="3" />
</something>
我想
<something>
this is sample data <xxx id="1" runat="server" /> and <xxx id="2" runat="server" />. More <yyy id="3" />
</something>
而不是:
<something>
this is sample data <xxx id="1" runat="server" /> and <xxx id="2" runat="server" runat="server"/>. More <yyy id="3" />
</something>
你Xcused! :-p – LarsH
SQL 2008 R2,如果有幫助的話 –