Skip to Content
0

How to write HANA SQL to find records with invalid characters

Mar 30, 2017 at 05:43 AM

328

avatar image

Hello Experts,

Please let me know how to perform a SQL query to find out invalid characters in a table column.

SELECT * FROM TABLE WHERE FIELD LIKE '%[^A-Za-z0-9]%'

Something like above code will work in normal SQL engines but not in HANA.

Are there any alternatives for [] defining range while doing the pattern search.

And if any alternatives works for NCLOB data type columns.

Thanks

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Lars Breddemann
Mar 30, 2017 at 06:52 AM
1

No, something like this wouldn't work with "normal" SQL engines, because the LIKE operator does not support regular expressions in the SQL standard.

What you can do, however, is to use the HANA SQL documentation and check for the LIKE_REGEXPR() function ( http://help-legacy.sap.com/saphelp_hanaplatform/helpdata/en/b4/0d483dd34d47aa9cc89b4d8a6e617e/content.htm )

Share
10 |10000 characters needed characters left characters exceeded
Josin George Mar 30, 2017 at 07:42 AM
0

Thanks Lars. That should work :)

Share
10 |10000 characters needed characters left characters exceeded
Kirill Gorin Mar 30, 2017 at 08:01 AM
0
Share
10 |10000 characters needed characters left characters exceeded