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

"Missing Semicolon" error when semicolon is there.

P: 26
Hi,
I am getting this error when I try to run my code:

Missing semicolon (;) at end of SQL statement

However, there is a semicolon at the end of my statement. Here is the statement:

INSERT INTO Schedule (UserID,MeetingDate,MainID,SecondID,ThirdID,Fourth ID,AddID) VALUES ('1','6/22/2007','10','12','12','12','13') ON DUPLICATE KEY UPDATE MainID='10',SecondID='12',ThirdID='12',FourthID='1 2',AddID='13';

*I am generating this SQL from an ASP website. I have asked it to display what the SQL will be, and that is what I have copied and pasted below. I am interfacing with Access 2000.
*UserID and MeetingDate are the Primary Keys to the table Schedule.

Can anyone help?

Thanks!
Jun 22 '07 #1
Share this Question
Share on Google+
4 Replies


puppydogbuddy
Expert 100+
P: 1,923
Hi,
I am getting this error when I try to run my code:

Missing semicolon (;) at end of SQL statement

However, there is a semicolon at the end of my statement. Here is the statement:

INSERT INTO Schedule (UserID,MeetingDate,MainID,SecondID,ThirdID,Fourth ID,AddID) VALUES ('1','6/22/2007','10','12','12','12','13') ON DUPLICATE KEY UPDATE MainID='10',SecondID='12',ThirdID='12',FourthID='1 2',AddID='13';

*I am generating this SQL from an ASP website. I have asked it to display what the SQL will be, and that is what I have copied and pasted below. I am interfacing with Access 2000.
*UserID and MeetingDate are the Primary Keys to the table Schedule.

Can anyone help?

Thanks!
Try it this way:

INSERT INTO Schedule (UserID,MeetingDate,MainID,SecondID,ThirdID,Fourth ID,AddID) VALUES ('1','6/22/2007','10','12','12','12','13') ON DUPLICATE KEY UPDATE MainID='10',SecondID='12',ThirdID='12',FourthID='1 2',AddID='13' & ;
Jun 23 '07 #2

P: 26
Thanks puppydogbuddy, I set it up so now the code generated is:

INSERT INTO Schedule (UserID,MeetingDate,MainID,SecondID,ThirdID,Fourth ID,AddID) VALUES ('1','6/23/2007','10','12','12','12','13') ON DUPLICATE KEY UPDATE MainID='10',SecondID='12',ThirdID='12',FourthID='1 2',AddID='13'& ';'

I am still getting the same error.

Any other ideas?

Thanks~~
Jun 23 '07 #3

P: 26
I figured out what it is. Access 2000 does not support the "ON DUPLICATE KEY UPDATE" syntax.

I'll work around it.

Thanks.
Jun 23 '07 #4

puppydogbuddy
Expert 100+
P: 1,923
I figured out what it is. Access 2000 does not support the "ON DUPLICATE KEY UPDATE" syntax.

I'll work around it.

Thanks.
If that is the problem, the message sure was cryptic.....but you are right about the on Duplicate Key syntax.....I was only looking at the semi-colon because of the message. My other thought is that the quotes at the beginning and end of the sql string were missing. If you are trying to eliminate duplicate records from the table, you may want to look at this link for ideas:

http://www.fabalou.com/Access/Querie...pe_records.asp
Jun 23 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.