Mastering the CHARINDEX() Function in SQL Server: A Detailed Guide
☰Fullscreen
Table of Content:
Syntax:
CHARINDEX('Expression_To_Find', 'Expression_To_Search', 'Start_Location')
Returns the starting position of the specified expression in a character string. Start_Location parameter is optional. In this example, we get the starting position of '@' character in the email string 'sara@aaa.com'.
Code:
Select CHARINDEX('@','sara@aaa.com',1)
Output:
The above code will produce the following result-
5