[GIS] Select by Attributes – Strings with < 5 characters

arcgis-desktoparcmapquerystringselect-by-attribute

I have a column of zip codes which are strings. Most of them are the usual 5 digit zip codes, but some are only 3 digits or missing a digit. (keep in mind, I need this column as strings for other reasons)

ex.

ZIP

234

4566

12345

I basically want to select everything that has less than 5 characters for further investigation. I'm sure there's an easy way to do this, but I'm having a difficult time figuring it out.

Best Answer

Using the Select by Attributes tool, you could enter the following SQL query to select all features with less than 5 characters in the ZIP field:

CHAR_LENGTH("ZIP") < 5
Related Question