Solved

Repalcing Single Quotes

Posted on 2008-06-09
2
812 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
2 Comments
 
LVL 22

Accepted Solution

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

Expert Comment

by:Mark Wills
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now