Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 10 Dec 2003 @ 08:13:09 GMT


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


Subj:   SQL Standard for the "%" wildcard on the LIKE predicate.
 
From:   Anomy Anom

<-- Anonymously Posted: Tuesday, December 09, 2003 19:05 -->

The % wildcard on the LIKE predicate causes non-standard behaviour.

create table test1000
(name char(10) );

insert into test1000 values ('NEW YORK');

/* The following correctly retrieves NEW YORK */

select * from test1000 where name = 'NEW YORK';

/* The following does not retrieve anything */

select * from test1000 where name like '%YORK';

/* When we append two spaces to the end, since name is defined as char(10), it retrieves NEW YORK correctly */

select * from test1000 where name like '%YORK  ';

Other databases don't exhibit this behaviour. Is this a bug, or is this how it's supposed to work?

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: 15 Jun 2023