简体   繁体   中英

Extract non numerical values from a numeric column in databricks

I have received a large database where the id column which should be numeric value (currently stored as string) has some non numeric values. I wanted to extract all such cases where the column has non numeric values. I am using DataBricks.

I tried this but couldn't find REGEXP_LIKE function

SELECT customer FROM customer_check
 WHERE REGEXP_LIKE (customer, '^[a-zA-Z]*$')

Thanks!

You can use rlike instead:

WHERE customer RLIKE '[^0-9]')

This will find any customer that has a character that is not a number. If numbers can be decimals or negative, you can extend the regular expression.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM