How to filter out the rows that there is a single quote in the content of a field? Or pencent sign? How to select a record with single quotes or percent signs in a field to query special characters (for example, %) in SQL using the escape-defined Escape Character for fuzzy query using the like keyword, when "%", "_", and "[]" appear separately, they are considered as wildcards. To check whether there are percent (%), underscore (_), or square brackets ([]) characters in a column of the character data type, you need to tell the DBMS, consider the characters in the like criterion as actual values rather than wildcards. The keyword escape allows you to determine an escape character, telling DBMS that the character following the escape character is considered as the actual value. The following expression: Like '% m %' escape 'M' defines the Escape Character "M" using the escape keyword ", tells DBMS to use the Second Percentile (%) in the search string "% m %" as the actual value, rather than the wildcard. Of course, the first percentile (%) is still considered as a wildcard, so the strings that meet this query condition are all strings ending with %. Before passing in the content entered by the user as a parameter value, escape the wildcard character (escape). That is to say, if the query condition entered by the user contains a wildcard character, these characters must be treated as data rather than wildcards.
In the personalmember table, find the record containing "[" in the strloginname field.
The following statements are available:
Select strloginname, * From personalmember where strloginname like '% \ [% 'escape '\'
Use the escape keyword to define the escape character. In mode, when an escape character is placed before a wildcard, the wildcard is interpreted as a common character. For example, to search for strings containing string 5% at any position, use:
Where Columna like '% 5/%' escape '/'
Query special characters