ERROR

There was an error executing the query. An invalid SQL statement was used. [ ]

Last Published: April 25, 2020

Error Message

When executing a WHERE clause, one of the following error messages is returned:

“There was an error executing the query.
An invalid SQL statement was used.
An invalid SQL statement was used. [NameOfTable]
An invalid SQL statement was used. [<SQL expression>]".

"Run-time error ‘-2147220985 (80040207)’:
Automation error
The owner SID on a per-user subscription doesn’t exist".

Cause

This error can occur when all of the following conditions are met:

· A SQL WHERE clause is used in an inner join (whether with the ArcMap Join Data dialog or the IRelQueryTable class), in the FeatureQueryName or TableQueryName class, or in the MakeQueryTable GP tool.

· The WHERE clause contains a numeric value with a decimal point.

· The data queried is a file geodatabase feature class or table.

· The locale is set to a language that uses a comma as the decimal separator, such as French or German.


The error occurs because the decimal point is being incorrectly interpreted as a comma.

For example, when it is executed, the following WHERE clause would produce the following error:

WhereClause = "ph = 6.6"

This error does not occur if the WHERE clause does not contain a decimal point.

Solution or Workaround

This problem does not occur in personal or ArcSDE geodatabases, so a workaround is to copy the feature class or table into one of these geodatabases and execute the query against the data there.

Note:
Changing the decimal point to a comma is not a workaround for this problem, and as always, it is still regarded as invalid SQL syntax. For example, the following Where clause does not work:

WhereClause = "ph = 6,6"

    Article ID:000010190

    Software:
    • ArcMap 9 x

    Receive notifications and find solutions for new or common issues

    Get summarized answers and video solutions from our new AI chatbot.

    Download the Esri Support App

    Discover more on this topic

    Get help from ArcGIS experts

    Contact technical support

    Download the Esri Support App

    Go to download options