REGEXP_LIKE conversion in SQL Server T-SQL

我的梦境 提交于 2019-12-01 06:41:53
WHERE PATINDEX ('%pattern%',expression)  !=0

If pattern is found , PATINDEX returns non zero value and you need to do a comparison in WHERE clause. A WHERE clause must be followed by comparison operation that returns true / false.

May be you are using PATINDEX without doing the comparison and that is why error message shows non boolean expression near WHERE clause.

To search for pattern learner_code with wildcard character

WHERE PATINDEX ('%' + CAST(learner_code AS VARCHAR) +'%',examCodes)  !=0

ORACLE'S REGEXP_LIKE supports actual regular expressions, PATINDEX only supports the % and _ wildcards, the [] list/range, and the ^ list/range negation.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!