Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 07 Mar 2012 @ 12:39:01 GMT


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


Subj:   Like keyword issues with %
 
From:   Anomy Anom

<-- Anonymously Posted: Wednesday, March 07, 2012 06:58 -->

Hi,

I am seeing an issue with column name LIKE with '%' usage. Please see below example to create 2 tables and find them using LIKE keyword.

     CT MYDB.HI_WORLD(C1 INT);
     CT MYDB.HELLO_WORLD(C1 INT);

     SELECT * FROM DBC.TABLES WHERE DATABASENAME='MYDB' AND TABLENAME LIKE
     '%WORLD' ;     ==> no rows returned

     SELECT * FROM DBC.TABLES WHERE DATABASENAME='MYDB' AND TABLENAME LIKE
     'H%WORLD' ;    ==> no rows returned

     SELECT * FROM DBC.TABLES WHERE DATABASENAME='MYDB' AND TABLENAME LIKE 'H%' ; ==> both the rows returned

I am expecting to see both the rows with all the 3 SELECT SQLs above. But only 3rd SELECT SQL works fine and others not.

Is it something I am missing here ? Or is there any guideline that % can't be used at start of the string and middle of the string but only at the end of the string ?


Thanks.



     
  <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: 27 Dec 2016