How do I search for a word in a string without using %like% because %like% only finds a string that begins with the word and not that actually has an occurance of the word(it could be in the middle of the string)
CharIndex will actually return a number -- that number will be the starting position in the string for the text you are searching for. If you SELECT statement states "WHERE FieldName Like '%searchstring%' then you should get matches whether the searchstring is at the beginning, end, or anywhere inside the string. The only way you would only get matches that start with searchstring is if you left off the wildcard at the beginning (i.e. WHERE FieldName Like 'searchstring%').
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.