I'm trying to pull data from ODBC using SQL that matches a pattern in "cell_id" column. My query is SELECT * FROM table_name WHERE cell_id REGEX_Match ('NRANR\[\d\].Ttwanr14'). But this didn't work.
Can anyone help please?
Solved! Go to Solution.
REGEX_Match is an Alteryx function. You can't use it in a database query.
Sometimes you have to pull back more data that you need from the database, then filter with Alteryx tools / functions.
Chris
@KimLamNg why don't you use the LIKE operator in your sql?
@binuacs Thank you for the suggestion. I wasn't aware of that operator.
I was able to get it work for more than one pattern using this query: SELECT * FROM `data_table` WHERE `cell_id` LIKE 'NRANR[%].Ttwanr14' OR `cell_id` LIKE 'NRANR[%].Ttwanr136';
I had to use "%" instead of a regex.
SQL is a universe of languages each which of which requires specific syntax. you can use regex in-db - but you'll need to review the specific type of SQL to get this to work (ie Snowflake/SQL Server/Postgres/Redshift/BigQuery etc...)