This is for SQL Server 2000 and I can't change that :(
I'm having some problems searching for the string
&
and replacing it with
&&
I'm targeting a text field (not full-text indexed)
I have tried with
UPDATE documents
SET doc_xml = REPLACE(doc_xml, '&' , '&&')
but this is not working as I have to escape the & char. I'd tried with
ESCAPE '\'
at the end, but no luck.
An example target content is this:
<FOLDER_Name>Buy&&Go</FOLDER_Name>
<PRODUCT_Name>Buy && Go</PRODUCT_Name>
<SKU_Name>Buy & Go</SKU_Name>
<COMPANY_Name>AT&T</COMPANY_Name>
I want to replace only the single
&
in those last two lines, and the result I need to obtain is this one:
<FOLDER_Name>Buy&&Go</FOLDER_Name>
<Product_Name>Buy && Go</Product_Name>
<SKU_Name>Buy && Go</SKU_Name>
<COMPANY_Name>AT&&T</COMPANY_Name>
I have to keep spaces as in the original content and also don't modify the strings that already have a double ampersand
&&