CHARINDEX(): find the first occurrence of a substring within another string : CHARINDEX « String Functions « SQL Server / T-SQL






CHARINDEX(): find the first occurrence of a substring within another string


1>
2> 
3>
4> -- CHARINDEX(): find the first occurrence of a substring within another string.
5>
6>
7> SELECT CHARINDEX('sh', 'Washington')
8> GO

-----------
          3

(1 rows affected)
1>
2>
           
       








Related examples in the same category

1.CHARINDEX: returns the starting point of the first occurrence of one string of characters within another string
2.CHARINDEX('Mars', 'The stars near Mars are far from ours')
3.CHARINDEX: Get index of the delimiting space
4.Combine CHARINDEX with substring