How to escape literal percent sign when NO_BACKSLASH_ESCAPES option is enabled?

you need escape

select * from mytable
where mycol like '5\% off' escape '\';

For a version that works regardless of NO_BACKSLASH_ESCAPES mode, you can use a different character, like pipe:

select * from mytable
where mycol like '5|% off' escape '|';

Leave a Comment