I have a table ( pages ) that contains properties for web pages, including a column for the content of the page itself, an NVARCHAR(MAX) column.
Inside this column, I need to find and replace a bunch of text strings and replace them with other text strings; these correlations are in the second table ( moving ) with the oldValue and newValue .
So, for example, if I start with two tables as follows:
page table:
ID Content 1 Words words Ancient words 2 Blah blah OutWithTheOld blah 3 Etc etc Useless etc
moving table:
OldValue NewValue Ancient Better OutWithTheOld InWithTheNew Useless Useful
... I need a way to make a replacement that leaves the page table as follows:
ID Content 1 Words words Better words 2 Blah blah InWithTheNew blah 3 Etc etc Useful etc
It is possible that for this record in the page table several substitutions will be required, and there is no way to predict whether the page record will not have any, one or several necessary replacements, or what values from moving.oldvalue will be found and need to be replaced.
I am using SQL Server 2008 and I am pretty new to this. Thanks so much for any help you can give!
Chris source share