In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

SQL Query with Regex

KimLamNg
9 - Comet

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?

4 REPLIES 4
ChrisTX
16 - Nebula
16 - Nebula

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

binu_acs
21 - Polaris

@KimLamNg why don't you use the LIKE operator in your sql?

KimLamNg
9 - Comet

@binu_acs 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.

 

apathetichell
20 - Arcturus

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...)

Labels
Top Solution Authors