cap-js/cds-dbs

Support of SQL not like operator in CQL

Closed this issue · 2 comments

Hello,

I am trying to await a select statement that uses the SQL syntax of "not like" on a HANA database. However, I found no description in the official CAP documentation or in examples. The service always returns a SQL syntax error.

Here is an example:

await SELECT.from('Foo') .where ({ name: { notLike:'%foo%'}, and: {
kind: { in: kinds },
or: { ratio: { between: min, and: max },
or: { stock: { '>=': stock } }
}
}})

I have tried different wordings and object structures such as "not like" and "notLike". I always get the sql syntax error.

These are the important dependencies:
"@cap-js/hana": "^1",
"@sap-cloud-sdk/openapi": "^3.16.0",
"@sap/cds": "^8.0.4",

Does anyone know how to use the cql syntax together with not like? It is supported for CAP?

Kind regards.

Hi,

did you try the alternating string/value syntax?

await SELECT.from('Foo') .where (
  'name not like', '%foo%', 'and kind in', kinds,
  'or ratio between', min, 'and', max, 'or stock >=', stock
)

closing due to inactivity, let us know if you need further assistance