Select to view content in your preferred language

Unable to perform SQL queries on a specific field of hosted feature layer

581
4
11-04-2021 01:38 PM
Labels (3)
DylanDavis
New Contributor II

Running ArcPro 2.8.1

I'm trying to run SQL queries on text field of a hosted feature layer but am given "There was an error in the expression." when making a definition query and "ERROR 000358: Invalid expression" when using the 'select by attributes' tool. Same result regardless of whether I'm using the query builder or writing the SQL query directly. I've tried simplifying to something as simple as "Field IS NOT NULL" to test but no luck.

What's really strange to me is that I can run queries on every other field in this feature layer.

Any ideas?

0 Kudos
4 Replies
jcarlson
MVP Esteemed Contributor

What kind of field is it? And what is the field name? It's possible to have a reserved SQL keyword as a field name, perhaps that's throwing things off.

- Josh Carlson
Kendall County GIS
0 Kudos
DylanDavis
New Contributor II

Field name: Grant

Data type: Text

0 Kudos
jcarlson
MVP Esteemed Contributor

Ah! "Grant" is definitely a reserved SQL keyword, and I would guess that it's causing the expression to fail. Can you try enclosing the field name in double quotes? "Grant"

- Josh Carlson
Kendall County GIS
0 Kudos
DylanDavis
New Contributor II

Ah, shucks. I didn't think it was, but clearly it is. Thanks for that. The double quotes don't seem to be working, unfortunately. Thankfully in this case it's not a big deal. I'll come up with another work-around.

Appreciate your assistance, Josh.

0 Kudos