Telerik OpenAccess Classic

Telerik OpenAccess ORM Send comments on this topic.
Wildcards
See Also
Programmer's Guide > OpenAccess ORM Classic (Old API) > Telerik OpenAccess ORM OQL Reference > OQL - Object Query Language > The WHERE Clause > Wildcards

Glossary Item Box

This documentation article is a legacy resource describing the functionality of the deprecated OpenAccess Classic only. The contemporary documentation of Telerik OpenAccess ORM is available here.

The wildcard character * represents zero, one or more characters in the search string. Wildcard characters are used in string literals. When using wildcards, you must use the LIKE operator rather than =.

New Comparison Operator for Wildcard Expressions: A change has been made to the OQL syntax in ODMG OQL 2.0. This concerns the use of wildcard expressions in search predicates. In earlier versions of the ODMG OQL standard, and in OpenAccess, the following expression was used:

OQL Copy Code
SELECT * FROM CustomerExtent AS customer
WHERE customer.ContactName = "M*"

Effective with ODMG OQL 2.0 and OpenAccess, the operator LIKE must be used while comparing a string expression using wildcards. The following is the new syntax for the preceding example query:

OQL Copy Code
SELECT * FROM CustomerExtent AS customer
WHERE customer.ContactName LIKE "M*"

The change was made to allow you to explicitly use the wildcard character in search strings. The first example returns Customer objects with the contact name attribute exactly as stated, i.e., "M*". The asterisk is not interpreted as the wildcard character.

The following example query uses a wildcard in the search string:

OQL Copy Code
Select * from CustomerExtent where ContactName like "S*"

The above query finds all those Customers whose contact names begin with the letter S.

Using the NOT Logical Operator Together with the LIKE Operator

The NOT operator is used for negating a criteria. Therefore, if you need to find instances that do not match a specified pattern, you can use NOT with the LIKE operator as shown below:

OQL Copy Code
Select * from CustomerExtent where NOT(ContactName like "S*")

The above query finds all those customers whose contact names do not begin with the letter S.

See Also