SQL Like Function not working! Help

2355
3
Jump to solution
11-11-2014 06:38 AM
Highlighted
New Contributor

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)
Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
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
Highlighted
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

Highlighted
MVP Esteemed Contributor

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

Highlighted
New Contributor

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

Reply
0 Kudos