MSSQL: a LIKE condition in a view's PROP:Filter is ignored; use SQL() or PROP:SQLFilter

Applies to: the MSSQL driver; no Clarion or server version is named in the thread.

Problem

A developer replaced a Clarion filter built with INSTRING and EVALUATE by a SQL filter on a view, and wanted a LIKE (a contains search). He tried MATCH with Match:Wild and then 'Bezeichnung LIKE ''%' & CLIP(Searchterm) & '%''' in SomeView{PROP:Filter}. The MSSQL Profiler showed no where clause arriving at the server.

Solution

  1. Wrap the SQL text in SQL() so the driver sends it as written. The syntax from the thread, with <39> for the quote character, is SomeView{PROP:Filter} = 'SQL(a.Bezeichnung LIKE <39>%' & CLIP(Searchterm) & '%<39>)' (the same with doubled quotes also appears). The poster confirmed it works.
  2. Alternatively assign the text to SomeView{PROP:SQLFilter}; the help for PROP:SQLFilter explains combining view filters and SQL filters.

Caveats

  • With a plain PROP:Filter the driver translates Clarion operators into SQL ones (CLIP becomes TRIM, MATCH becomes LIKE; UPPER and LOWER stay) and replaces Clarion column names with database names. With SQL() or PROP:SQLFilter it does no translation at all.
  • A plain = filter appeared to work without SQL() because = needs no translation. The poster's hits may have been luck: "and" equals "and" but not "hand".
  • One poster suspected the plain filter was applied on the client side, not sent as a where clause; this was not tested in the thread. His advice was to compare the Clarion trace or the debugger.
  • The help topic "SQL (use SQL code)" is said to have gotchas around SQL aliases.

Today (2026)

Likely still the way to send a LIKE to the server from a view filter; not re-tested.

Sources: Heinz (Aug 2016, the question), Simon K., John G., Jeff S., Jon W., Liam, Arnor B. (Aug 2016) in softvelocity.clarion.databasedrivers.