If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > How to handle quotation marks in varchar fields?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-15-04, 12:35
James Foreman James Foreman is offline
Registered User
 
Join Date: May 2004
Posts: 1
How to handle quotation marks in varchar fields?

I've got some customer data where some names will have ' within them (eg O'Brien). The data comes through in all upper case; although we can format most names correctly by putting it into lower case (except for the first letter), I don't see how to deal with changing letters after a '. How do you refer to a ' mark without DB2 thinking you're just giving the first ' mark in referring to a string?

(DB2 8.1.2 on Suse 8)
Reply With Quote
  #2 (permalink)  
Old 05-15-04, 14:28
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
To escape a single quote character you need to double it - put two single quotes together. For example:
Code:
INSERT INTO USERS (LAST_NAME) VALUES ('O''Brien') WHERE USER_ID = ?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On