CHARINDEX string function is used to find out the starting position of an expression/string/character in another expression/string.
CHARINDEX ( expressionToFind ,expressionToSearch [ , start_location ] )
--CHARINDEX()---FIRST OCCURANCE OF STRING OUTPUT:
SELECT CHARINDEX('first', 'CHARINDEX is used to find out the first occurance of a string')
It doesn't allow you to search for partial string or pattern... For instance, is you wish to search for the pattern...
SELECT CHARINDEX('wild%search', 'CHARINDEX does not support wild card characters to search for pattens')
Actually, the pattern wild%search is found in the given expression, but the above CHARINDEX returns 0 as starting position. It will treat wild card characters as normal one; searches for the character '%' in the given string..