Select query won't give expected result in linux script

66 views Asked by At

I am trying the retrieve the data which have the special character (') single quote.

My query is

select * from table_name nolock WHERE value LIKE "%'%" and col_value = 1

I am connecting to the database through Linux script and trying to execute the above query in SYBASE DB.

While using below query getting Syntax error

select * from table_name nolock WHERE value LIKE "%'%" and col_value = 1

While using below query Getting no result

select * from table_name nolock WHERE value LIKE \"\%\'\%\" and col_value = 1
1

There are 1 answers

0
AntuanSoft On

The scape character for sybase is [' (single quote)], your query will run if you write:

select * from table_name nolock WHERE value LIKE "%''%" and col_value = 1