I’m trying to find all the data in ColumnX where the Data begins with a \.
Is like '\%' what I’m looking for? But the \ has to be at the beginning.
I’m trying to find all the data in ColumnX where the Data begins with
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The backslash
\can have special meaning inLIKEpatterns. It’s the defaultESCAPEcharacter in PostgreSQL or MySQL – but not in Oracle or SQL Server. (Can be modified with an addedESCAPEclause in subtly varying ways, follow link for your RDBMS.)In addition to that, PostgreSQL used to interpret POSIX-style escapes in strings (a.k.a. “C escape syntax”) before version 9.1 and MySQL still does in version 8.0). There you have to double
\to\\to get an ordinary backslash.According to standard SQL,
\is not a meta character in strings. PostgreSQL eventually switched to standard behavior and introduced a special escape-string-syntax withE''and the config settingsstandard_conforming_stringsandescape_string_warningto still allow escaped string when needed.Since Postgres 9.1
standard_conforming_strings = onby default. So you write:Else you have to write:
On top of that,
\also has special meaning in many client programs and programming languages. If strings get interpreted before they even reach the database engine, you may have to double the\another time (or escape it in some other fashion). See this related question, for instance.