Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 06 May 2008 @ 10:53:55 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: Pattern matching in Teradata SQL
 
From:   Fernandes, Royson

Hi,

Try this; it seems to work just fine:

R followed by 1 digit:

     sel COLUMN1  FROM TABLE_NAME
     WHERE SUBSTRING (COLUMN1 FROM (POSITION('R' IN COLUMN1) ) FOR 2)
               BETWEEN 'R0' AND 'R9'

R followed by 2 digit:

     sel COLUMN1  FROM TABLE_NAME
     WHERE SUBSTRING (COLUMN1 FROM (POSITION('R' IN COLUMN1) + 1) FOR 1)
     BETWEEN '0' AND '9' and
     SUBSTRING (COLUMN1 FROM (POSITION('R' IN COLUMN1) + 2) FOR 1)
     BETWEEN '0' AND '9'

Thanks,

Royson Fernandes



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023