开发者

I want a db2 query to which satisfy the following condition

开发者 https://www.devze.com 2023-02-21 21:52 出处:网络
I have requirement to fetch all the rows which have value in some column like d\'souza or in the form of something\'something i tried using a like query as \'[a-zA-Z]\'\'%\' but its not working.开发者

I have requirement to fetch all the rows which have value in some column like d'souza or in the form of something'something i tried using a like query as '[a-zA-Z]''%' but its not working.开发者_C百科 please need your help


Try LIKE with '%''%'

Sadly SQL's LIKE statement doesn't offer advanced RegEx functionality (Though that might be different for db2). But after you've filtered your results like that, you can do the fine-grained checking by using a script or as part of your application.

[EDIT] As you wrote that you have restrictions regarding the % sign at the beginning of the statement you could try something complicated like:

'a''%' OR 'b''%' OR ... 'A''%' OR 'B''%' ...

Not very beautiful code, but effective.


I hope this is what you are looking for .kindly read the post.

DB2 database, regexp is not supported (without additional libraries).

Emulate REGEXP like behaviour in SQL

0

精彩评论

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