FIX: "Syntax Error" with SQL Literal String Over 16,379 Bytes (194127)
The information in this article applies to:
- Microsoft ODBC Driver for Access 1.0
- Microsoft ODBC Driver for Access 2.0
- Microsoft ODBC Driver for Access 3.0
- Microsoft ODBC Driver for Access 3.5
- Microsoft ODBC Driver for Access 3.6
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q194127 SYMPTOMS
If you attempt to execute a SQL INSERT statement that contains a literal
string having over 16,379 characters with the Microsoft ODBC Driver for
Access, the following error message occurs:
[Microsoft][ODBC Microsoft Access 97 Driver]
Syntax error in INSERT INTO statement.
SQL UPDATE SQL statements with literal strings over 16,379 bytes also fail
with a similar error.
CAUSE
The SQL parser for the Microsoft ODBC Driver for Access prior to 4.0.4202 does not accept string literals larger than 16,379 bytes. This is the defined limit for literal strings in a SQL statement for the Microsoft ODBC Driver for Access.
With the Microsoft ODBC Driver for Access versions 4.0.4202 and later, you can execute a SQL INSERT containing a string literal having over 16,379 characters. However, you will get the following error message with a SQL INSERT that contains a literal string having over 516,076 characters:
[Microsoft][ODBC Microsoft Access Driver]
Query is too complex
This error occurs with both Access 97 and Access 2000 databases.
RESOLUTION
There are two possible workarounds for the syntax error:
- The Microsoft ODBC Driver for Access versions 4.0.4202 and later allow SQL INSERTS with string literals having up to 516,076 characters.
- Use parameterized insert or updates rather than embedding literal strings into the SQL statements if you expect to insert or update large string values. This resolution works with all versions of the Microsoft ODBC Driver for Access.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
This bug has been fixed in the Microsoft ODBC Driver for Access versions 4.0.4202 and later. Note that version 4.0.4202 of the Odbcjt32.dll file is installed by MDAC 2.1 service pack 2.
However, a new limitation of 516,076 characters now applies.
You may obtain the latest version of the Microsoft Data Access Components from the following Microsoft Web site:
REFERENCES
For additional information about the error message "Query is too complex", please click the article number below
to view the article in the Microsoft Knowledge Base:
103429 ACC:"Out of Memory" or "Query Too Complex" with Query/Report"
Modification Type: | Major | Last Reviewed: | 12/3/2003 |
---|
Keywords: | kbADO210sp2fix kbbug kbDatabase kbDriver kbfix kbJET kbMDACNoSweep KB194127 |
---|
|