?
Solved

Repalcing Single Quotes

Posted on 2008-06-09
2
Medium Priority
?
860 Views
Last Modified: 2008-06-11
Hello All,

I am trying to replae single quotes ( ' )  with the word 'ft' in our database table.
Below is the syntax I am using:

Update Product
Set      MetaDescription = RTRIM(LTRIM(Replace(MetaDescription, ' ' ', 'ft' ))),
      LongDescription = RTRIM(LTRIM(Replace(LongDescription, ' ' ', 'ft')))

But I get the error msg:
Msg 105, Level 15, State 1, Line 2
Unclosed quotation mark after the character string '', '))) '.
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near '', ')))

I have tried enclosing the single quote in double quotes as in ( " ' " ). Still no luck.

Thanks for your help.
0
Comment
Question by:godwineffiong
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 22

Accepted Solution

by:
dportas earned 500 total points
ID: 21746997
UPDATE Product
SET      MetaDescription = RTRIM(LTRIM(Replace(MetaDescription, '''', 'ft' ))),
      LongDescription = RTRIM(LTRIM(Replace(LongDescription, '''', 'ft')));
0
 
LVL 51

Expert Comment

by:Mark Wills
ID: 21760596
Yeah, it is a trap, you actually need 4 single quotes there is a quote at start and end, then a quote before the single quote to let it know it is definitiely a single quote (kind of like a control character)


Update Product  Set MetaDescription = RTRIM(LTRIM(Replace(MetaDescription, '''', 'ft' ))),  LongDescription = RTRIM(LTRIM(Replace(LongDescription, '''', 'ft')))

and probably (to minimise the number of changes) want a: where (metadescription like '%''%' or longdescription like '%''%')

0

Featured Post

How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question