We have two function in SQL Server to find out position of INDEXCHARINDEX( ) and PATHINDEX( ) , Both function are used to find out index postion and both have two arguments
With PATINDEX, must include percent signs before and after the pattern, unless for the pattern as the first (omit the first %) or last (omit the last %) characters in a column. For CHARINDEX, the pattern cannot include wildcard characters. The second argument is a character expression, usually a column name, in which Adaptive Server searches for the specified pattern.
Example of CHARINDEX:
Select CHARINDEX('Expresion',columnName) from TABLENAME
Examples of PATINDEX:
Select PATHINDEX('%Expresion%',columnName) from TABLENAME
Both return integer value , if not available , it returns Zero(0);
No comments:
Post a Comment