﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / T-SQL (SS2K5)  / Updating varchar(max) column / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 19 Jun 2013 02:36:22 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Updating varchar(max) column</title><link>http://www.sqlservercentral.com/Forums/Topic668537-338-1.aspx</link><description>As first I would suggest to change the type of your VARCHAR(MAX) column to XML.Here a little example:[code]DECLARE @v VARCHAR(MAX)SET @v = '&amp;lt;Root&amp;gt;&amp;lt;Age&amp;gt;45&amp;lt;/Age&amp;gt;&amp;lt;/Root&amp;gt;'DECLARE @xml XMLSET @xml = @vSET @xml.modify('   replace value of (/Root/Age/text())[1]   with "20"   ')select @xml[/code]GreetsFlo</description><pubDate>Wed, 04 Mar 2009 15:25:27 GMT</pubDate><dc:creator>Florian Reischl</dc:creator></item><item><title>RE: Updating varchar(max) column</title><link>http://www.sqlservercentral.com/Forums/Topic668537-338-1.aspx</link><description>The xml data looks something like thisdata id="AGE_CAT"AGE-30/data data id="BMI_CATEGORY"data id="HEIGHT"instead of 30 is the age column in table is updated to 35 the xml column should reflect this change.</description><pubDate>Wed, 04 Mar 2009 14:30:25 GMT</pubDate><dc:creator>ishaan99</dc:creator></item><item><title>RE: Updating varchar(max) column</title><link>http://www.sqlservercentral.com/Forums/Topic668537-338-1.aspx</link><description>somehow xml data doesnt show up to clarify the questions. its something likexml =  </description><pubDate>Wed, 04 Mar 2009 14:06:25 GMT</pubDate><dc:creator>ishaan99</dc:creator></item><item><title>RE: Updating varchar(max) column</title><link>http://www.sqlservercentral.com/Forums/Topic668537-338-1.aspx</link><description>Running an update directly on xml column wont help as its a concatenation of age, dob, firstname, lname and many other columns. something likeif age = 35xml =  ........(how is it possible to change the 63 to 35) .  </description><pubDate>Wed, 04 Mar 2009 14:03:37 GMT</pubDate><dc:creator>ishaan99</dc:creator></item><item><title>RE: Updating varchar(max) column</title><link>http://www.sqlservercentral.com/Forums/Topic668537-338-1.aspx</link><description>What exactly are you trying to accomplish?  Just running an update on the xml column or creating a trigger so the xml column is updated everytime the age changes?  Could you send an example of what the xml column might look like?  Is it true xml?  Cheers,Brian</description><pubDate>Wed, 04 Mar 2009 12:07:06 GMT</pubDate><dc:creator>beezell</dc:creator></item><item><title>Updating varchar(max) column</title><link>http://www.sqlservercentral.com/Forums/Topic668537-338-1.aspx</link><description>I have a table which has column age and this column gets used in another column(xml) in the same table. ex table1Age varchar(3),xml  varchar(max) - This is an xml column which is a concatenation of many columns in the table and age is one of them if age = 35xml =  ........(how is it possible to change the 63 to 35) . This is not just one records there are quite a few with different age. so how can i get this in single update than writing multiple updates for each user. ANy help on this wil lbe greatly appreciatedTIA</description><pubDate>Wed, 04 Mar 2009 11:29:54 GMT</pubDate><dc:creator>ishaan99</dc:creator></item></channel></rss>