Pattern for LIKE Operator

Database

Pattern for LIKE Operator

Hi All,

I'm trying to search a specific pattern using LIKE operator, but i'm not sure if i'm doing the right way.

For Eg:

MY cloumn values are ABC_INFO_Calc, ABC_CALC_PRO, ABC_201501, ABC_201412.

I would like to slect the last two values and any value matching that (ABC_201501, ABC_201412).

I'm trying something like this  

where table_name like 'ABC_[0-9]%'

But no results while i run the query.

Can anyone help me with the parsing pattern in Teradata.

3 REPLIES
Enthusiast

Re: Pattern for LIKE Operator

This will work.

where table_name like 'ABC_%'
and table_name like any ('%1%','%2%','%3%','%4%','%5%','%6%','%7%','%8%','%9%');

Rglass

Junior Contributor

Re: Pattern for LIKE Operator

If you're on TD14 you might use a Regular Expression:

where REGEXP_SIMILAR(table_name, 'ABC_[0-9].*') = 1

Re: Pattern for LIKE Operator

Thanks for the Reply, i'm using TD14 and that worked fine