Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2004
    Location
    London, England
    Posts
    71

    Arrow Unanswered: Probably Very Simple

    I need to enter some data into a databse using SQL. However, how do you enter a value into a string which contains a quote?

    I am using the normal INSERT statement ie
    INSERT INTO table
    VALUES (1, 2, 'Here's the problem', 4)
    etc..

    Answers on a postcard please?
    Simon Baynes
    www.simonbaynes.com

    'The only way to discover the limits of the possible is to go beyond them into the impossible.'
    Arthur C. Clarke

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    Which DBMS? For Oracle the answer is to double up embedded quotes:

    INSERT INTO table
    VALUES (1, 2, 'Here''s the problem', 4)

    (Note that that is two 's, not one ")

  3. #3
    Join Date
    Apr 2004
    Location
    Kansas City, MO
    Posts
    734
    Same with Microsoft SQL Server
    MeanOldDBA
    derrickleggett@hotmail.com
    When life gives you a lemon, fire the DBA.

Posting Permissions

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