How to get the position of a character from a word in SQL server.

For this there is a function call CHARINDEX(). This is very similar to InStr function of VB.NET and IndexOf in Java. This function returns the position of the first occurrence of the first argument in the record.

SELECT CHARINDEX('r','server')

This would return 3 as it is start from 1.

Comments

Popular posts from this blog

SQL SERVER – TRIM() Function – UDF TRIM()

Delete duplicate records from a Table in SQL Server