none
syntax error in insert into statement access 2007 RRS feed

  • Question

  • Hi:

    I am executing following command on access 2007 via both programmatically and direct in access,

    INSERT INTO tbl_sync_queue(EmlStr,EntryID,ItemLogID,TimeStamp,UserID,IsQueued,ErrorCode,TriesCnt) VALUES('MIME-Version: 1.0
    Message-ID: <CHILKAT-MID-490b6498-a251-2422-769f-b453368365c6@PCVITA134.exchdomain.com>
    X-Mailer: Chilkat Software Inc (http://www.chilkatsoft.com)
    X-Priority: 3 (Normal)
    Subject: test on to
    Date: Tue, 13 Sep 2011 11:48:32 +0530
    From: "Unknown" <Sender>
    Return-Path: Sender
    To: haseena@pcvita.com, venkat@pcvita.com, pavan@pcvita.com
    Content-Type: multipart/alternative;
        boundary="-----_chilkat_fa4_75cf_bed41570.961dbbdc_.ALT"

    This is a multi-part message in MIME format.

    -------_chilkat_fa4_75cf_bed41570.961dbbdc_.ALT
    Content-Transfer-Encoding: quoted-printable
    Content-Type: text/plain;
        format=flowed

    Test on To, cc, bcc
    -------_chilkat_fa4_75cf_bed41570.961dbbdc_.ALT--
    ','0000000067C3D046E19ED046B4585D4C80BCE9DE070079277E2B9B6414409E34C4A0695233870000000D95C7000079277E2B9B6414409E34C4A0695233870000000D9
    9440000',0,#12/5/2012 4:13:42 PM#,1,'0',0,0);

    I am getting syntax error in both.

    While tried it on ms-access ignoring column names i.e. , (EmlStr,EntryID,ItemLogID,TimeStamp,UserID,IsQueued,ErrorCode,TriesCnt) part, its executing fine!!!

    but if I tried with column names, its giving syntax error and focus is on "TimeStamp".

    I am not able to find what mistake at there.

    Please advise.

    Thanks,

    Shailesh

    Wednesday, December 5, 2012 12:22 PM

Answers

  • Hi,

    TimeStamp is a reserved keyword, that's why you will have to either change the name of the table column to use a non-reserved name, or to enclose it in brackets in your INSERT-statement, like [TimeStamp].

    Marcel



    • Edited by Marcel Roma Wednesday, December 5, 2012 1:18 PM
    • Marked as answer by Shailesh_gurjar Wednesday, December 5, 2012 1:34 PM
    Wednesday, December 5, 2012 1:04 PM

All replies

  • Hi,

    TimeStamp is a reserved keyword, that's why you will have to either change the name of the table column to use a non-reserved name, or to enclose it in brackets in your INSERT-statement, like [TimeStamp].

    Marcel



    • Edited by Marcel Roma Wednesday, December 5, 2012 1:18 PM
    • Marked as answer by Shailesh_gurjar Wednesday, December 5, 2012 1:34 PM
    Wednesday, December 5, 2012 1:04 PM
  • Thanks for your solution.. it works..!!
    Wednesday, December 5, 2012 1:35 PM