I finally (albeit reluctantly) made the switch from a personal geodatabase (pGDB) to a file geodatabse (fGDB) not too long ago. The main reason it took so long to switch has to do with how Select by Attributes deals with string functions.
For example, I used to be able to easily select all records where the first character of a particular field starts with "A".
left([Some_Field],1 = "A")
This works without a hitch when querying against a pGDB. However, try to do the same thing against a fGDB.
left("Some_Field",1 = "A")
This returns the following error:
There was a problem selecting
An invalid SQL statement was used.
I realize I can use the field calculator to calculate a new field equal to the first character of some other field. But who wants to do that every time?
Is there a way to use string functions inside Select By Attributes?
Answer
Your queries should follow the SQL format discussed here. For what you're looking for, you can use something like this:
"Some_Field" LIKE 'A%'
The % is a wild card, so this would return records that have values in "Some_Field" that start with 'A'.
No comments:
Post a Comment