January 25, 2008 at 4:46 am
Hello,
Another probably very simple question so I apologise in advance :blink:
I have a string that contains lots of characters and I want to find % within the string to only bring back the rows that contain this character. However the query looks like this AND Sessions LIKE '%%%'
and it doesnt work.......
Does anyone know how to actually look for a wildcard in the data using the wildcard?
Thanks
Debbie
January 25, 2008 at 5:03 am
AND Sessions LIKE '%'+char(37)+'%'
January 25, 2008 at 5:14 am
Thanks for that!!!
Brilliant :w00t:
January 25, 2008 at 5:53 am
LIKE '%/%%' ESCAPE '/'
Means that the character after the / is treated as a literal, not as a wildcard.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 25, 2008 at 6:05 am
also
AND CHARINDEX('%',Sessions)>0
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply