"Missing Semicolon" error when semicolon is there.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • liz0001
    New Member
    • Jun 2007
    • 26

    "Missing Semicolon" error when semicolon is there.

    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,Meeting Date,MainID,Sec ondID,ThirdID,F ourthID,AddID) VALUES ('1','6/22/2007','10','12' ,'12','12','13' ) ON DUPLICATE KEY UPDATE MainID='10',Sec ondID='12',Thir dID='12',Fourth ID='12',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!
  • puppydogbuddy
    Recognized Expert Top Contributor
    • May 2007
    • 1923

    #2
    Originally posted by liz0001
    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,Meeting Date,MainID,Sec ondID,ThirdID,F ourthID,AddID) VALUES ('1','6/22/2007','10','12' ,'12','12','13' ) ON DUPLICATE KEY UPDATE MainID='10',Sec ondID='12',Thir dID='12',Fourth ID='12',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,Meeting Date,MainID,Sec ondID,ThirdID,F ourth ID,AddID) VALUES ('1','6/22/2007','10','12' ,'12','12','13' ) ON DUPLICATE KEY UPDATE MainID='10',Sec ondID='12',Thir dID='12',Fourth ID='1 2',AddID='13' & “;”

    Comment

    • liz0001
      New Member
      • Jun 2007
      • 26

      #3
      Thanks puppydogbuddy, I set it up so now the code generated is:

      INSERT INTO Schedule (UserID,Meeting Date,MainID,Sec ondID,ThirdID,F ourthID,AddID) VALUES ('1','6/23/2007','10','12' ,'12','12','13' ) ON DUPLICATE KEY UPDATE MainID='10',Sec ondID='12',Thir dID='12',Fourth ID='12',AddID=' 13'& ';'

      I am still getting the same error.

      Any other ideas?

      Thanks~~

      Comment

      • liz0001
        New Member
        • Jun 2007
        • 26

        #4
        I figured out what it is. Access 2000 does not support the "ON DUPLICATE KEY UPDATE" syntax.

        I'll work around it.

        Thanks.

        Comment

        • puppydogbuddy
          Recognized Expert Top Contributor
          • May 2007
          • 1923

          #5
          Originally posted by liz0001
          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:

          Comment

          Working...