English

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

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"