Questions tagged [xml.modify]

xml.modify is a function in MS SQL to modify xml data.

In MS SQL Server, xml data can be edited in SQL queries using the function xml.modify.

29 questions
4
votes
1 answer

SQL Server append XML child nodes to parent node

I need to have a script which can insert / append new xml child nodes to a pre-existing xml parent node. --New child nodes DECLARE @XMLChildData XML SET @XMLChildData = ' Gary
user3917837
  • 43
  • 1
  • 4
3
votes
1 answer

Remove a specific xml node with namespace using groovy

Trying to remove xml nodes using groovy. Here want to remove requiredByDate element, which is present multiple times and has namcespace with a prefix. Looked at many examples available on the net, and stackover as well. Some of them are close. If…
Rao
  • 20,781
  • 11
  • 57
  • 77
2
votes
2 answers

Update xml node value from secondary table using join based current node value

Table dbo.table_a contains a XML column foo. Every row has a XML-tree in the a XML-column. Secondary table dbo.table_b contains old value old_val and new value new_val The XML-tree looks like this ACME
dbd
  • 531
  • 1
  • 7
  • 18
2
votes
2 answers

Change element name with xml.modify or other method in TSQL

Suppose you have a TSQL query: 1 as 'Category1/@Level', 2 as 'Category2/@Level', t.MainCat as 'Category1', t.SubCat as 'Category2' FOR XML PATH (''), ROOT('Taxonomy') which generates following result:
J3FFK
  • 664
  • 3
  • 14
  • 32
1
vote
2 answers

TSQL using modify to initialise a null column

Using TSQL modify how can I initialise a null column with a root XML element, and use the value of a column to create/populate a nested element? From what I can tell, there's no way to create a root XML node on a NULL column using modify. Example…
freefaller
  • 19,368
  • 7
  • 57
  • 87
1
vote
1 answer

Parse, Update, Delete XML elements

I have the following sample XML and I am looking to Update: ShipToAddress1 to: test777 TestID to: 1234 where Sequence =1 20220619
vbgp
  • 73
  • 7
1
vote
1 answer

How to update xml in table having multiple same elements in xml, from data by joining another table

I have table which is having XML column. Now this XML column have multiple tags like an array. Each of these tags have an attribute() which i want to update from a table by joining it. Table_A is as following Id XML 1 "
1
vote
1 answer

How to set a multi-valued XML attribute using SQLXML modify

I'm trying to use the SQLXML modify function to update a multi-value (xs:list) attribute. I can set multiple values when constructing the XML (from a string), but SQLXML modify doesn't let me set multiple values. The initial XML:
bassguy007
  • 145
  • 1
  • 7
1
vote
2 answers

Updating XML type column with condition

Hopefully a quick question to be answered by the XML experts. I have a the following table with a XML type column with the below XML schema and data in one record: INSERT INTO XMLTEST (testXML) values ('

1
vote
1 answer

Inserting XML nodes using PLPGSQL

I am using PLPGSQL to process a XML column called XMLland. I have a column filled with information on land that I am not able to change but I can add to. As part of a loop that I am aware is functoning, due to other statements, I am looking to…
Matt
  • 31
  • 8
1
vote
1 answer

delete nodes from xml efficiently

Here's a challange. The code below shows a working method of deleting some rows from an xml variable. The intention is to delete the rows which do not have the primaryKey attribute set to 1, where the oldValue and newValue attributes are the same.…
Colin Dawson
  • 435
  • 2
  • 12
1
vote
1 answer

Modify multiple rows of SQL Server XML data

I have a temp table that contains values I want injected as elements into a SQL Server column. I can do this for one entry using the modify and insert statements. But how can I do this for multiple rows in a table? Some sample data looks like…
CorribView
  • 711
  • 1
  • 19
  • 44
1
vote
1 answer

JAVA modifying XML file

I'm trying to modify my Config.xml file from JAVA program, file contains data about MySql connection. Here's the code after button click: DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); File f = new…
Rytis
  • 59
  • 8
1
vote
1 answer

XML DML Replace with a Function Result

I would like to dynamically replace the value of an XML Element, in selected XML value(s) being retrieved from a table. This replacement needs to be performed by a function that I would like to call. I can't even begin to find any clues to point me…
TDNeuman
  • 11
  • 2
1
vote
1 answer

Remove Varying levels of empty XML tags in SQL Server

I am using FOR XML EXPLICIT to union to convert some SQL table info into an XML file. It's all working, but I have loads of empty tags in the results, at all sorts of different levels. I would like to remove all the empty tags, but keep the top…
High Plains Grifter
  • 1,357
  • 1
  • 12
  • 36
1
2