OData query $filter conditions and case-sensitivity

eseib picture eseib · Nov 21, 2012 · Viewed 22.8k times · Source

Does OData specify whether filter conditions on string fields are to be evaluated case-sensitively or case-insensitively?

Example: (from the docs)

/Suppliers?$filter=Address/City eq 'Redmond' 

Is this expected to be case-sensitive or not?

If I want to offer both options, how can this be expressed? There is a tolower() function that can be used like:

/Suppliers?$filter=tolower(Address/City) eq 'redmond'

or

/Suppliers?$filter=tolower(Address/City) eq tolower('Redmond')

Isn't there a more concise way to express case-insensitive matching?

Answer

Vitek Karas MSFT picture Vitek Karas MSFT · Nov 21, 2012

The "eq" operator is supposed to be case sensitive. Usage of tolower (or toupper) is the currently recommended way of doing this.