question

aaryansh avatar image
aaryansh asked

Logic to modify multiple nodes of xml variable in sql server

Hello, I am stuck working with an xml datatype in sql server. I am trying to replace multiple nodes of an xml variable in sql server, but haven't been successful. Could you please share your thoughts on how I could handle the query? Thank you... Issue: In the XML(variable), I am trying to set text in Value element to "White" for all attributes with CustomProperty Name="Color" The Value element is like Black But, Value can contain any other color, even "#rrggbb" RGB codes are allowed. The xml: DECLARE @xmled XML SET @xmled = en-US Gee0eb52b-44ad Entity 1 Entity 1 Gee0eb52b-308d-44ad-96e4-75b1cfa1d36e MandatoryFilter Red Attribute 1 String Ascending 4 en-US true true Merge White Attribute 2 String true Ascending 2 en-US Dropdown Blue Attribute 3 String true Ascending 7 en-US Dropdown
sql-server-2008sql-server-2012tsqlxmlxquery
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.