2

I have a Xml Column in a SQL Server 2012 database table called ValidationList. I have a few hundred records in this table.

I have a record like follows

<Configuration xmlns="blah">
  <CheckTest name="ValidationA">
    <TestName>NumericTest</TestName>
  </CheckTest>
</Configuration>

I need to Update all the rows and Rename the Node TestName to ValidationName, how can i do this in SQL script?

Thanks

1 Answer 1

3

Here's one way just using replace:

update yourtable
set yourcolumn = 
       replace(cast(yourcolumn as nvarchar(max)), 'TestName', 'ValidationName');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.