LIKE & ESCAPE Feature in SQL Cockpit

Should wildcard characters be part of the search term? What should I do?

The solution is very easy in our SQL Cockpit, LIKE statement must be told that for example ‘%‘ is understood as a simple character instead of wildcard character. This is done by placing a special character in front of it and specifying this character as an „ESCAPE character“ at the end of command.

Example

User wants to select the table line(s) which in DOKTEXT field are containing the 100% word.

The database table contains the following entries.

Using the LIKE addition with the pattern will have the following result, because the percent sign represents zero, one, or multiple characters in SQL.

The first and last percent signs indicate that before and after the string any content is possible. The middle percent sign is connected with the escape character ‚\‘ and is therefore part of the search string. This specification ‚\%‘ is to be understood as a character, because of ESCAPE ‘\’ addition.

Links

https://help.sap.com/doc/abapdocu_740_index_htm/7.40/en-US/abenwhere_logexp_like.htm

https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abenwhere_logexp_like.htm

https://help.sap.com/viewer/4fe29514fd584807ac9f2a04f6754767/2.0.00/en-US/20fa17f375191014a4d8d8cbfddfe340.html?q=LIKE

  • Posted by Attila Kajtar
  • On Februar 24, 2021
Tags: ESCAPE, LIKE, SQL, SQL Cockpit

0 Comments