Results 1 to 2 of 2
  1. #1
    Join Date
    May 2004
    Posts
    1

    Unanswered: 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)

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    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 = ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •