What do we mean by CHARINDEX function in Sql Server?

 Posted by vishalneeraj-24503 on 11/3/2014 | Category: Sql Server Interview questions | Views: 452 | Points: 40

CHARINDEX is an in-built Sql Server function that accepts two arguments.The first argument is the character which are being searched for and the second parameter is the original string expression.It will return the first index position that the character passed into the first argument which is present inside the string expression.

CHARINDEX (string_char_to_find,string_char);

For Ex:-
SELECT CHARINDEX(' ','Hello World');

H = 1,
e = 2,
l = 3,
l = 4 and so on.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response