Applies To:
  • CitectSCADA 5.xx, 6.xx, 7.xx
  • Vijeo Citect 6.10, 7.xx

Summary:
When calling the INSERT INTO SQL statement via the SQLExec Cicode function I receive an ODBC error 3502 stating:
 
[ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement

I have checked my syntax and it all looks correct. What else could this mean?

Solution:
There are some keywords such as number or date which cannot be used as table/column names in your SQL database if you wish to use the in-built SQL functions. You will need to either:

  * use square brackets around the keyword. For example,
     INSERT INTO YOURDBTABLE (colOne,colTwo,[date]) VALUES ('somestring1','somestring2','20-08-2010')
     OR

  * rename the fields in the database to something else. For example, you can append underscores to the names ("TIME_", "DATE_", "DESC_").

Keywords:
INSERT INTO, SQL, SQLExec, ODBC

Attachments