English

How To: Escape wildcards when selecting by attributes

Summary

Certain characters, such as an asterisk, may be reserved in SQL statements as wildcards, depending on the source data type. If a string contains that character, using it in Select by Attributes requires an escape character.

Procedure

Example of using escape characters to select records containing a character normally read as a wildcard:

  1. In the following selection of a personal geodatabase feature class, only "test*test" needs to be selected. However, all records are selected from the attribute table because of the wildcard character.
    [O-Image]

  2. To ignore the wildcards and only select records that contain "*", brackets have been inserted into the expression as MS Access escape characters:
    [O-Image]
    Note:
    In the file geodatabase, the "ESCAPE" keyword can be used to designate another character as the escape character. For for information, see the help link in Related Info.

Related Information