SUBSTRING is used to find the portion of a string from a given string.
Syntax: SUBSTRING ( expression ,start , length )
CHARINDEX is used to find the starting position of a specified expression in a given string.
Syntax: CHARINDEX ( expressionToFind ,expressionToSearch [ , start_location ] )
PATINDEX is used to find the starting position of the first occurrence of a pattern in a given string.
Syntax: PATINDEX ( '%pattern%' ,expression )
Syntax: SUBSTRING ( expression ,start , length )
SELECT SUBSTRING('SQL FIGHTER',5,7) AS SUBSTRING_VALUE
CHARINDEX is used to find the starting position of a specified expression in a given string.
Syntax: CHARINDEX ( expressionToFind ,expressionToSearch [ , start_location ] )
SELECT CHARINDEX('L','HELLO WORLD') AS CHARINDEX_VALUE_1
SELECT CHARINDEX('L','HELLO WORLD',7) AS CHARINDEX_VALUE_2
PATINDEX is used to find the starting position of the first occurrence of a pattern in a given string.
Syntax: PATINDEX ( '%pattern%' ,expression )
SELECT PATINDEX('%SERV%','SQL SERVER SERVICE') AS PATINDEX_VALUE