Select to view content in your preferred language

SQL Like Function not working! Help

6732
3
Jump to solution
11-11-2014 06:38 AM
Jean-PierreBourget1
Deactivated User

Hello all,

 

I am having a hard time using the Like function within the Select Attributes feature of my Attributes table. The expression that I typed in is being verified as correct however, it is coming up with no results. [Unit_Name] LIKE '*Limestone*'  is the expression that I am using. However, even though there are many records that have the word limestone in it, it says that there are 0 results. I tried [Unit_Name] ='*Limestone*'   and this seems to work fine, but when I use like it doesn't.. any suggestions?

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JakeSkinner
Esri Esteemed Contributor

Hi Jean-Pierre,

If your data resides in a File or SDE Geodatabase, you will want to use '%' instead of '*'.  See the following link:

ArcGIS Help (10.2, 10.2.1, and 10.2.2)

The wildcards you use to conduct a partial string search also depend on the data source you are querying. For example, in a file-based or ArcSDE geodatabase data source, this expression would select Mississippi and Missouri among USA state names:

STATE_NAME LIKE 'Miss%'

The percent symbol (%) means that anything is acceptable in its place—one character, a hundred characters, or no character. The wildcards you use to query personal geodatabases are asterisk (*) for any number of characters and question mark (?) for one character.

View solution in original post

3 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Jean-Pierre,

If your data resides in a File or SDE Geodatabase, you will want to use '%' instead of '*'.  See the following link:

ArcGIS Help (10.2, 10.2.1, and 10.2.2)

The wildcards you use to conduct a partial string search also depend on the data source you are querying. For example, in a file-based or ArcSDE geodatabase data source, this expression would select Mississippi and Missouri among USA state names:

STATE_NAME LIKE 'Miss%'

The percent symbol (%) means that anything is acceptable in its place—one character, a hundred characters, or no character. The wildcards you use to query personal geodatabases are asterisk (*) for any number of characters and question mark (?) for one character.

DanPatterson_Retired
MVP Emeritus

regardless of the wildcard being used (either for SDE shapefile gdb etc) you have used a wildcard with two positional spots

='*Limestone*'   means anything before Limestone and anything after...  since this one failed

='Limestone*'   you are indicating that the phrase must begin with the word Limestone but anything else after

Jean-PierreBourget1
Deactivated User

Thanks Jake! That did the trick. Thanks Dan for the extra insight!

0 Kudos