Archives of the TeradataForum
Message Posted: Wed, 10 Dec 2003 @ 08:13:09 GMT
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.
|