SELECT PATINDEX('%M_rs%', 'The stars near Mars are far from ours') : PATINDEX « String Functions « SQL Server / T-SQL Tutorial






4> SELECT PATINDEX('%M_rs%', 'The stars near Mars are far from ours')
5> GO

-----------
         16

(1 rows affected)
1>








12.11.PATINDEX
12.11.1.PATINDEX searches for a pattern of characters within a string.
12.11.2.SELECT PATINDEX('%M_rs%', 'The stars near Mars are far from ours')
12.11.3.select PATINDEX('%v_r%', 'SQL Server')
12.11.4.WHERE PATINDEX('%computer[^s]%', notes) > 0
12.11.5.Finding the Start Position of a String Within Another String Using Wildcards