CHARINDEX is a SQL Server string function that returns the starting position of a specified expression within another string.
It is especially useful when working with SQL Server and extracting information from structured text.
Find the position of the @ symbol in an email address using SQL Server.
SELECT
Email,
CHARINDEX('@', Email) AS AtPosition
FROM Customers;
CHARINDEX is commonly used in SQL Server for text parsing, data cleansing, and extracting parts of strings.
- CHARINDEX is commonly associated with SQL Server.
- It searches for a substring.
- It returns the starting position.
- It is useful for text parsing.
- Syntax differs from other database systems.
What does CHARINDEX do?
CHARINDEX returns the starting position of a specified substring within another string in SQL Server.
Is CHARINDEX standard across all databases?
No. CHARINDEX is primarily associated with SQL Server.