Updating Xml attributes with new values in a SQL Server 2008 table
Posted
by
SMD
on Stack Overflow
See other posts from Stack Overflow
or by SMD
Published on 2012-09-22T17:13:40Z
Indexed on
2012/09/23
9:37 UTC
Read the original article
Hit count: 564
I have a table in SQL Server 2008 that it has some columns. One of these columns is in Xml format and I want to update some attributes.
For example my Xml column's name is XmlText
and it's value in 5 first rows is such as:
<Identification Name="John" Family="Brown" Age="30" />
<Identification Name="Smith" Family="Johnson" Age="35" />
<Identification Name="Jessy" Family="Albert" Age="60" />
<Identification Name="Mike" Family="Brown" Age="23" />
<Identification Name="Sarah" Family="Johnson" Age="30" />
and I want to change all Age
attributes that are 30 to 40 such as below:
<Identification Name="John" Family="Brown" Age="40" />
<Identification Name="Smith" Family="Johnson" Age="35" />
<Identification Name="Jessy" Family="Albert" Age="60" />
<Identification Name="Mike" Family="Brown" Age="23" />
<Identification Name="Sarah" Family="Johnson" Age="40" />
© Stack Overflow or respective owner