The SUBSTRING() function is returns a part of given string or we can say this function is extract some characters from given string.
Syntax – SUBSTRING(String, start, Length);
Example-
CHARINDEX() in SQL:
CHARINDEX() function is searches for a substring from String and returns the position or index number of particular substring from given String. If substring is not found then it returns 0.
Syntax- CHARINDEX(substring, string, start);
Start is optional in CHARINDEX() function.
Example-
In the following SQL statement the start number is provide where the searching is start. By default the starting position is 1.
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
SUBSTRING() in SQL:
The SUBSTRING() function is returns a part of given string or we can say this function is extract some characters from given string.
Syntax – SUBSTRING(String, start, Length);
Example-
CHARINDEX() in SQL:
CHARINDEX() function is searches for a substring from String and returns the position or index number of particular substring from given String. If substring is not found then it returns 0.
Syntax- CHARINDEX(substring, string, start);
Start is optional in CHARINDEX() function.
Example-
In the following SQL statement the start number is provide where the searching is start. By default the starting position is 1.