开发者

CHARINDEX always 0 when looking for substring

I have the following in a field ABCD, EFG, HIJ and can confirm this by selecting it. I need to be able to search this string for ABCD so I used the following:

case
when CHARINDEX(g.letters ,'ABCD') 开发者_开发百科<> 0
then (- 2)
else (- 1)
end

However its always returning -1


Try

CHARINDEX('ABCD', g.letters)

The first parameter is the expression to find and the second parameter is the expression to be searched.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜