SQL Server 2008 R2
Returns the starting position of the specified expression in a character string.
The following example searches for the expression "an" from the last names of the employees in a database.
SELECT [Last Name], CHARINDEX('an', [Last Name]) AS Position
FROM Employees
This is the result set:
Last Name..............Position ------------------------------ Davolio 0 Fuller 0 Leverling 0 Peacock 0 Buchanan 5 Suyama 0 King 0 Callahan 7 Dodsworth 0 Hellstern 0 Smith 0 Patterson 0 Brid 0 Martin 0 Pereira 0
