By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,257 Members | 2,812 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,257 IT Pros & Developers. It's quick & easy.

INSERT INTO (Unmatched Single Quotes)

P: 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', 's****@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
Nov 19 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Nov 19, 8:56*am, zufie <john.marru...@illinois.govwrote:
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', 's****@onionflavoredrings.com', 'M',
'1970-04-01', 'Punk', 'Grover''s Mill, NJ', 'Single', 'smashing the
state', 'compatriots, guitar players');

Thanks,

John
Nov 19 '08 #2

P: n/a
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', 's****@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.


Nov 19 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.