IndexOf function in T-SQL

前端 未结 4 1150
广开言路
广开言路 2020-12-09 00:43

Given an email address column, I need to find the position of the @ sign for substringing.

What is the indexof function, for strings in T-SQL?

L

4条回答
  •  旧时难觅i
    2020-12-09 00:57

    CHARINDEX is what you are looking for

    select CHARINDEX('@', 'someone@somewhere.com')
    -----------
    8
    
    (1 row(s) affected)
    

    -or-

    select CHARINDEX('c', 'abcde')
    -----------
    3
    
    (1 row(s) affected)
    

提交回复
热议问题