How to use ESCAPE in SQLite?

Try this answer and no luck:

I am using the SQLite Database browser (built with 3.3.5 SQLite engine) to execute this query:

SELECT columnX FROM MyTable

WHERE columnX LIKE  '%\%16'  ESCAPE '\'  

In the column X, I have a row with data:sampledata%167

I follow the instruction and do not receive any returned data, but am not mistaken?

http://www.sqlite.org/lang_expr.html

(SQLite with API C)

+3
source share
2 answers

I think the problem is that you are missing %from the end of the template.

'%\%16%'

, , , . , escape-:

WHERE columnX LIKE '%!%16%' ESCAPE '!'
+6

%167, , %16. , , % 167, , .

SQLite, :

sqlite> create table foo (bar text);
sqlite> insert into foo (bar) values ('sampledata%167');
sqlite> select * from foo where bar like '%\%16' escape '\';
sqlite> select * from foo where bar like '%\%167' escape '\';
sampledata%167

SQLite , , , .

+1

Source: https://habr.com/ru/post/1764243/


All Articles