% (Wildcard)

% (Wildcard)

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

% (Wildcard)

Used with the LIKE operator to construct patterns for matching.

Comments

Used with the LIKE operator in logic expressions, the % wildcard matches zero or any number of subsequent characters when the pattern on the right is compared to expression1.

Example

"_ ob%"

Matches any character string whose second and third letters are ob, followed by zero or more characters (i.e., “Robert”, “Bob”, “Cobbler”, etc.).

compute Employees where LastName like "_ a%n"

Processes all records whose LastName values are three characters or more, the second character being an a and the last character being an n.

Grade like "100\%"

Shows the percent sign being used literally in a string. (The first backslash “escapes” the second backslash, which, in turn, “escapes” the percent sign, turning it into a literal character.)

find Parts where PartDesc like "%\\%"

Finds parts whose part description contains a backslash.

FirstName like $ concat(" S_e%p", SuffixVariable)

Assuming that SuffixVariable is “%”, then the above expression is logically true if FirstName matches the pattern “S_e%p%”.

The LIKE Operator, The %Wildcard and SQL Servers

The LIKE Operator with %Wildcard sometimes operate differently in SQL servers than in ZIM. The following construction:

find Parts where PartDesc like "%e"

in some SQL servers might only retrieve records when the PartDesc ends exactly with an “e” in the last position of the field. If PartDesc is 5 characters long, the “rode” and “are” will not be retrieved, whereas “there” and “force” will be.

To solve this situation, the above construction must be written this way:

find Parts where $trim(PartDesc) like "%e"

See Also

Conventions

How To Construct Logic Expressions

How To Use Logic Expressions

Was this article helpful?
5 out of 5 stars

1 rating

5 Stars 100%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

pt_BRPortuguese