createtablecustomers(_idid,segmentstring);insertintocustomers(_id,segment)values(1,'this is great')select_id,charindex('is',segment)ascharindexfromcustomers;_id|charindex-----+-----------1|2
CHARINDEX with starting from POSITION
createtablecustomers(_idid,segmentstring);insertintocustomers(_id,segment)values(1,'this is great')select_id,charindex('is',segment,3)ascharindexfromcustomers;_id|charindex-----+-----------1|5
CHARINDEX not found
createtablecustomers(_idid,segmentstring);insertintocustomers(_id,segment)values(1,'this is great')select_id,charindex('foo',segment)ascharindexfromcustomers;_id|charindex-----+-----------1|-1