Connecting Tech Pros Worldwide Help | Site Map

INSERT INTO (Unmatched Single Quotes)

  #1  
Old November 19th, 2008, 03:05 PM
zufie
Guest
 
Posts: n/a
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@onionflavoredrings.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
  #2  
Old November 19th, 2008, 03:15 PM
zufie
Guest
 
Posts: n/a

re: INSERT INTO (Unmatched Single Quotes)


On Nov 19, 8:56*am, zufie <john.marru...@illinois.govwrote:
Quote:
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...@onionflavoredrings.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)...This solution inputs the word Grover's with an
apostrophe as it should.

Here's my code:

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

Thanks,

John
  #3  
Old November 19th, 2008, 03:35 PM
Salad
Guest
 
Posts: n/a

re: INSERT INTO (Unmatched Single Quotes)


zufie wrote:
Quote:
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@onionflavoredrings.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.




Closed Thread