Solved

sql update statement

Posted on 2007-11-27
11
464 Views
Last Modified: 2013-12-18
I need to run this update statement

UPDATE SIEBEL.EIM_ADDR_PER SET AP_COUNTRY = 'Korea, Democratic People's Rep'

the problem comes in with the "People's" the statement recognizes the 's as the end.

Thanks for your help.
0
Comment
Question by:rrisal
[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
  • 2
  • 2
  • +3
11 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 168 total points
ID: 20358540
UPDATE SIEBEL.EIM_ADDR_PER SET AP_COUNTRY = 'Korea, Democratic People''s Rep'
0
 

Author Comment

by:rrisal
ID: 20358587
angellll thanks for the suggestion but when i run that the result i get is

Korea, Democratic People''s Rep

The desired result i was looking for was just one quotation

Korea, Democratic People''s Rep

Is there a way to do this? Thanks.
0
 
LVL 19

Assisted Solution

by:erikTsomik
erikTsomik earned 166 total points
ID: 20358599
i AGRRE WITH angelIII. The problem is apostrphies
you can also try something like this I am not sure about syntax but it is something like that
declare @str as varchar;
declare @str2 as varchar;
Set @str='Korea, Democratic People's Rep'
set @str2=replace(@str,"'", "''")
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 20

Expert Comment

by:steelseth12
ID: 20358625
escape character in mysql is backslash (\)

UPDATE SIEBEL.EIM_ADDR_PER SET AP_COUNTRY = 'Korea, Democratic People\'s Rep'

angelIII is in mssql mode :)
0
 
LVL 35

Assisted Solution

by:johnsone
johnsone earned 166 total points
ID: 20358814
In angelIII's response, that is two single quotes, not a double quote.

Escaping a single quote will not work.  You should get a ORA-01756 with steelseth12's query.

The other way to do it is this:

UPDATE SIEBEL.EIM_ADDR_PER SET AP_COUNTRY = 'Korea, Democratic People' || chr(39) || 's Rep'
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 20358860
>angelIII is in mssql mode :)
the '' (2 single quotes) will also work in Oracle...  the chr(39) "trick" is not needed, but will work also in oracle.
0
 
LVL 20

Expert Comment

by:Muhammad Wasif
ID: 20358879
You can escape a single quote with another single quote too.
0
 
LVL 20

Expert Comment

by:Muhammad Wasif
ID: 20358887
angelIII already explained it :-)
0
 
LVL 35

Expert Comment

by:johnsone
ID: 20359189
angelIII,

I know the chr(39) trick is not needed and the two single quotes works.  I was just giving another alternate.  I prefer your solution.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

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…
Lotus Notes has been used since a very long time as an e-mail client and is very popular because of it's unmatched security. In this article we are going to learn about  RRV Bucket corruption and understand various methods to Fix "RRV Bucket Corrupt…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

623 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