XPath contains
Last modified: January 19, 2026
Overview
The contains() function tests whether a string attribute contains a specific string as a sub-string.
String comparisons in XPath constraints are generally case-insensitive, but this can depend on the collation setting for some databases. See Case-Sensitive Database Behavior for more information.
Example
This query returns all the customers from which the name contains the string an:
[contains(Name, 'an')]
//Sales.Customer[contains(Name, 'an')]
Customers with the name "Andy" or "Jan" will be returned, for example, because "an" is part of those names.