I'm not even sure if this can be done in TSQL or if I'll have to write something separately. I would like to replace image URLs from description fields which are within a cell based on another table. The file name remains constant, but the location changes.Example: DescriptionTableid description1 This item is for sale with a 20% coupon <img src="http://mysite.com/321654987321654987.jpg"> 2 Everyone needs a Widget! Buy one today! <img src="http://yoursite.com/test/159481592658165165.jpg"> 3 This product will make you happy <img src="http://tmpsite.org/984651513849846516.jpg">
Example: ReplacementTableid original replacement1 http://mysite.com/ http://NEWPlace.com/2 http://yoursite.com/test/ https://localPage.com/test/3 http://tmpsite.org/ http://temporary.org/
Here we see that DescriptionTable has the information written within an HTML block. ImageReplacement has unique IDs that do not appear casually within the code. They can only refer to the link I want to replace.If I had to write software, I would SELECT each description cell & do a RegexFind per url, then SELECT the original + replacement & finally do a RegexReplace. Is there a way to do that in TSQL?-SergioI use Microsoft SQL 2008