charindex函数的使用

charindex(expression1,expression2[,start_location])

expression1是要到expression2字符串中寻找的字符,

如果start_location为零,负数或者没有,则表示从起始位置开始寻找,

函数返回的整数为expression1在expression2中的位置。

例:charindex('SQL','Microsoft SQL Server')  返回的值为11

      charindex('SQL','Microsoft SQL Server',3) 返回值还是11

      charindex('7.0','Microsoft SQL Server') 返回值还是0     (因为此字符串没有'7.0')

posted @ 2015-07-15 14:49  H_XinYi  阅读(543)  评论(0编辑  收藏  举报