Questions tagged [xml-dml]

The XML Data Modification Language (XML DML) used Microsoft SQL Server 2005 and above to manipulate data in an XML field.

XML Data Modification Language (XML DML) is an extension of the XQuery language. XML-DML keywords include - insert - delete - replace value of

XML DML is similar to Oracle XU (XQuery Update).

63 questions
1
vote
1 answer

How to update xml node value based on another node value in SQL Server

I have the following employees XML in "Test" table 1 John doe 1 2 John doe 2 3
praveen
  • 95
  • 15
1
vote
1 answer

How to update the existing node value of XML by multiplying it with n times in SQL Server

Here is the XML I have in my Table Field 3
Naveen
  • 111
  • 1
  • 9
1
vote
1 answer

Delete node based on other node's attribute value

I have the following XML being returned in SQL and I would like to use SQL XML DML to conditionally remove a node based on the value of a different node. In my example, I would like to remove the “Color” node when the value of the “Value” attribute…
1
vote
1 answer

SQL Server insert XML node is adding namespace

I have an existing XML column that I'd like to append a node to, but the node is being added with an unwanted namespace. DECLARE @x XML = '
RSSM
  • 669
  • 7
  • 19
1
vote
1 answer

TSQL XML Convert node value to int

I have XML in TSQL, Declare @xml XML = '
1
vote
2 answers

Insert xml into another xml using t-sql

There is received xml file from which I get the frame of consignor. Then I generate an answer xml where I would like to use some block from source xml. That is why I try to insert "consignor" variable which is instance of xml into another xml…
V. Ivanova
  • 41
  • 5
1
vote
1 answer

Insert XML element with attribute into SQL XML column

I have the following XML data stored in [MyTable].Column1 which is an XML type column. I want to insert a new element to it: I'm using the following SQL, it executed successfully but when I query the same column value again, I do not see my new…
Fylix
  • 2,551
  • 6
  • 45
  • 72
1
vote
1 answer

Using XML.Modify how to insert a node UNDERNEATH an existing node

Using SQL and the function xml.modify is there anyway to add a new node underneath a specific node? Here is my XML 1 10
abarz12
  • 27
  • 1
  • 4
1
vote
2 answers

SQL replace a null xml value

I'm a beginner in sql, and I don't know how to find a solution to my problem. I have a table with items, a column contains xml value. I want to check if a field exist and update it. I find a way to modify an existing xml value, but when it's NULL it…
A.Pissicat
  • 3,023
  • 4
  • 38
  • 93
1
vote
2 answers

Use SQL Server modify('insert') to append data to xml column

Consider the following situation. I have the following table CREATE TABLE [dbo].[GoldenEgg] ( rowIndex int NOT NULL IDENTITY(1,1), AccountNumber varchar(256) NULL, SubscriptionID int NOT NULL, …
iambdot
  • 887
  • 2
  • 10
  • 28
1
vote
1 answer

t-sql update XML element value based on another element value

Using SQL Server 2012, if I have the following value in one row of an XML type column: OutputFileName
Beneque
  • 11
  • 2
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

Replace value of empty XML node in SQL Server's XQuery

I tried the following ways and could not find a way to replace empty node value without deleting it and without using XML attributes. Replace node is not available in MS-SQL. DECLARE @doc xml SET @doc = ' 1 ' print '1) ' +…
alpav
  • 2,972
  • 3
  • 37
  • 47
1
vote
2 answers

Deleting a parent node

I have have the following xml fragment in a column in SQL Server
James A Mohler
  • 11,060
  • 15
  • 46
  • 72
1
vote
1 answer

XML DML for 2008 R2..How to modify nested Elements

2 7/8" x 1",Drill Collar,2 3/8 PAC 2 7/8" x 1",Drill Collar,2 3/8 PAC 1
Bayrat
  • 161
  • 1
  • 3
  • 17