Problem using the LIKE operator in a query

1274
2
Jump to solution
08-28-2020 12:39 PM
JosephElfelt1
Occasional Contributor

This query command works fine.

https://geodata.epa.gov/arcgis/rest/services/ORD/ROE_PercentChangeCarbonStorage/MapServer/2/query?f=...

But this one with a wildcard fails.

https://geodata.epa.gov/arcgis/rest/services/ORD/ROE_PercentChangeCarbonStorage/MapServer/2/query?f=...

All the documentation says % is a wildcard for 0-to-many characters.

What am I doing wrong?

0 Kudos
1 Solution

Accepted Solutions
JayJohnsonWashoeCounty
Occasional Contributor III

Because the % sign is special in URLs, you have to use a code (i.e. escaping the character) so it knows you mean to use the % as a wildcard and not in its normal URL context.  

Try this (use %25 instead of just %):

https://geodata.epa.gov/arcgis/rest/services/ORD/ROE_PercentChangeCarbonStorage/MapServer/2/query?f=GeoJSON&returnGeometry=true&outFields=*&where=CountyName LIKE 'Skag%25'

Jay

Jay
Washoe County GIS

View solution in original post

2 Replies
JayJohnsonWashoeCounty
Occasional Contributor III

Because the % sign is special in URLs, you have to use a code (i.e. escaping the character) so it knows you mean to use the % as a wildcard and not in its normal URL context.  

Try this (use %25 instead of just %):

https://geodata.epa.gov/arcgis/rest/services/ORD/ROE_PercentChangeCarbonStorage/MapServer/2/query?f=GeoJSON&returnGeometry=true&outFields=*&where=CountyName LIKE 'Skag%25'

Jay

Jay
Washoe County GIS
JosephElfelt1
Occasional Contributor

Thank you Jay

Apparently my brain cell that used to know that tidbit has died.

Joseph Elfelt

0 Kudos