Replace two double-quotes with one double-quote

R

Ray C

I have a table that may have values such as "".
This same table may even have three double quotes i.e. """.

I need to run a query that replaces the two double-quotes with a single
double-quote. And then another query that replaces the three double quotes
with one double quote.

Help.
 
J

John Spencer

Replace 3 to 1

UPDATE SomeTable
SET SomeField = Replace(SomeField,Chr(34) & Chr(34) & CHr(34), Chr(34))
WHERE SomeField LIKE "*"" & Chr(34) & CHr(34) & CHr(34) & "*"

Replace 2 to 1
UPDATE SomeTable
SET SomeField = Replace(SomeField,Chr(34) & Chr(34) , Chr(34))
WHERE SomeField LIKE "*"" & Chr(34) & CHr(34) & "*"

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top