question

Slick84 avatar image
Slick84 asked

How do I isolate a few characters to not show up in my results?

I have promo codes with 6 characters each. Like so: AOIE0S and so on... now I dont want this particular one showing up in my results because it's got both a "Zero" and an letter "O". I dont want any promo codes with zeroes or the letter o's showing up in my result set. I tried my query but it won't work.
---------- select code from promo_tbl where code not like '_0' and code not like '_o' ----------
tsql
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Tim avatar image
Tim answered
You forgot to specify the wild card %
4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Tim avatar image Tim commented ·
It happens to us all. Me more so than others. :)
1 Like 1 ·
Slick84 avatar image Slick84 commented ·
I didnt know you had to include the % wild card when I was already using the _ wild card. This is what worked for me but your answer led me to it. --- code not like '%O_%' and code not like '%0_%' ---
0 Likes 0 ·
Tim avatar image Tim commented ·
I didn't want to give you the entire answer, just wanted to lead you to it. '%0%' and '%O%' should work as well. Glad you got it working the way you need.
0 Likes 0 ·
Slick84 avatar image Slick84 commented ·
yeah, lol i was looking into other wildcard characters so much that i forgot my basics..
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.