Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 994371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:33:55+00:00 2026-05-16T06:33:55+00:00

I have an interesting behavior that I would like to better understand so I

  • 0

I have an interesting behavior that I would like to better understand so I don’t get hung up misusing it by accident.

The following is an example of escaping a ‘%’ in a WHERE clause:

select * from #z where b like '%e%' ESCAPE 'e'

In this table with these values:

create table #z (a int, b varchar(10))
insert into #z values (1, 'e25%')
insert into #z values (2, '25')
insert into #z values (3, '18%')
insert into #z values (4, 'cab')
insert into #z values (5, '2%')

selects the three rows with the % at the end.

However, if I replace like '%e%' with like 'ee%' it selects only the first row. Thus it appears that double-escaping the % is like a double-negative, and undoes the escape, thus making the % back into the wildcard again. Am I understanding this correctly? Or is there something else going on here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:33:56+00:00Added an answer on May 16, 2026 at 6:33 am

    I don’t actually use ESCAPE: I’ve always found it odd.
    In this case, you’re escaping the 2nd e so you get like 'e%' (with no escape)

    Personally, I’d use this like '%[%]' (with no escape) where possible

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an interesting genetics problem that I would like to solve in native
I have found some interesting behavior and do not know why or how to
I have this interesting situation. I have a bunch of structs that hold a
I have an interesting one. I have a WP site that I need to
I have an interesting SQL problem that I need help with. Here is the
I have an interesting problem. The basis of the problem is that my last
I have some xml that looks like this: <rootElement attribute=' > '/> This is
I saw some interesting compiler behavior yesterday and I think I understand why it's
K here is an interesting problem We have an app that is presenting with
I have found out that C++ standard functions show very different behavior when having

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.