October 22, 2024
Chicago 12, Melborne City, USA
SQL

Update XML node value into as lower case using T-SQL in SQL Server


I’ve a table with one XML data type column.
XML format as below

Table: RootTable

+----+------------------------------------------------------+
|Id  | Data                                                 |
+----+------------------------------------------------------+
|1   | <Root><Id>1</Id><SubRoot>Production</SubRoot></Root> |
+----+------------------------------------------------------+
|2   |  <Root><Id>1</Id><SubRoot>Test</SubRoot></Root>      |
+----+------------------------------------------------------+

I need to update XML as below,

+----+------------------------------------------------------+
|Id  | Data                                                 |
+----+------------------------------------------------------+
|1   | <Root><Id>1</Id><SubRoot>production</SubRoot></Root> |
+----+------------------------------------------------------+
|2   |  <Root><Id>1</Id><SubRoot>test</SubRoot></Root>      |
+----+------------------------------------------------------+

Here I need to update the SubRoot’s value all to lower case.
Kindly help me on how to update this using T-SQL in SQL Server.



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video