INSERT INTO (Unmatched Single Quotes)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • zufie

    INSERT INTO (Unmatched Single Quotes)

    Does MS Access utilize something like a backlash (\) to make the
    following SQL code work?

    (SQL uses a backlash (\) to make the following SQL code work).

    Here is my code:

    INSERT INTO my_contacts
    VALUES ('Funyon', 'Steve', 'steve@onionfla voredrings.com' , 'M',
    '1970-04-01', 'Punk', 'Grover's Mill, NJ', 'Single', 'smashing the
    state', 'compatriots, guitar players');

    I removed the unmatched single quote in the word ('Grover's -->
    'Grovers) to make the code work in MS Access.

    Thanks for your ideas!

    John
  • zufie

    #2
    Re: INSERT INTO (Unmatched Single Quotes)

    On Nov 19, 8:56 am, zufie <john.marru...@ illinois.govwro te:
    Does MS Access utilize something like a backlash (\) to make the
    following SQL code work?
    >
    (SQL uses a backlash (\) to make the following SQL code work).
    >
    Here is my code:
    >
    INSERT INTO my_contacts
    VALUES ('Funyon', 'Steve', 'st...@onionfla voredrings.com' , 'M',
    '1970-04-01', 'Punk', 'Grover's Mill, NJ', 'Single', 'smashing the
    state', 'compatriots, guitar players');
    >
    I removed the unmatched single quote in the word ('Grover's -->
    'Grovers) to make the code work in MS Access.
    >
    Thanks for your ideas!
    >
    John
    Ok, found another solution...add a second single quote
    (Grover''s)...T his solution inputs the word Grover's with an
    apostrophe as it should.

    Here's my code:

    INSERT INTO my_contacts
    VALUES ('Funyon', 'Steve', 'steve@onionfla voredrings.com' , 'M',
    '1970-04-01', 'Punk', 'Grover''s Mill, NJ', 'Single', 'smashing the
    state', 'compatriots, guitar players');

    Thanks,

    John

    Comment

    • Salad

      #3
      Re: INSERT INTO (Unmatched Single Quotes)

      zufie wrote:
      Does MS Access utilize something like a backlash (\) to make the
      following SQL code work?
      >
      (SQL uses a backlash (\) to make the following SQL code work).
      >
      Here is my code:
      >
      INSERT INTO my_contacts
      VALUES ('Funyon', 'Steve', 'steve@onionfla voredrings.com' , 'M',
      '1970-04-01', 'Punk', 'Grover's Mill, NJ', 'Single', 'smashing the
      state', 'compatriots, guitar players');
      >
      I removed the unmatched single quote in the word ('Grover's -->
      'Grovers) to make the code work in MS Access.
      >
      Thanks for your ideas!
      >
      John
      Don't know about the \. Not sure why the code above would work without
      a field list.

      You might be better off using a " instead of ' when surrounding the
      values. IOW, "Grover's Mill, NJ" instead of 'Grover's Mill, NJ'

      I created Table1 with fields F1 and F2. The following code worked IF a
      record exists in Table1. If no records existed, nothing was inserted.

      INSERT INTO Table1 ( F1, F2 )
      SELECT Distinct "Test" , "Value" FROM Table1;

      The above statement might be easier to write.




      Comment

      Working...