ArcMap – Why NULL Value is Not Equal to Empty Value for Attribute

arcmapexpressionqueryselect-by-attribute

I have a feature layer in a gdb. It has an attribute named uniqueid. Some of rows have a value for uniqueid and some do not. I am trying to select only the features that have a value (are not blank).

enter image description here

Using the Select by Attributes dialog box, I am trying to create an expression that will weed out the blank features. I tried using where: unique IS NOT NULL but that selected everything, both the features with a value and those that were blank. I then tried using Get Unique Values and chose '', which was one of the options. It through an error. What am I doing wrong here? How can I select just the features that have a value for the uniqueid attribute field?

enter image description here

Here's the actual text version of the error as requested:

There was a problem selecting

An invalid SQL statement was used. An invalid SQL statement was
used.[fottprint_cslf_union_20181004] An invalid SQL statement was
used.[SELECT OBJECTID FROM footprint_cslf_union_20181004 WHERE
uniqueid IS NOT '']

Best Answer

The IS NOT syntax can only be used with null but you have a '' (an empty string value delimited by quote) so the correct syntax should be uniqueid <> ''

I think this is because your field is a text field where null/none/empty value are stored as empty string (thus the '' in the value selector), in a numeric field you get "real" null value and could use the uniqueid IS NOT null syntax

Related Question