MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » October 2004

Re: SQL Like vs. = sign



fixed

CREATE TABLE ROB/XYZ1 (NAME CHAR (15 ) NOT NULL WITH DEFAULT)
INSERT INTO ROB/XYZ1 VALUES('ROB')
INSERT INTO ROB/XYZ1 VALUES('ROB BERENDT')
CREATE INDEX ROB/XYZ1L1 ON ROB/XYZ1 (NAME ASC)

SELECT * FROM ROB/XYZ1 WHERE NAME LIKE 'ROB'
No data selected for output.

SELECT * FROM ROB/XYZ1 WHERE NAME LIKE 'ROB            '
....+....1....+ 
NAME 
ROB 
********  End of data

So it will find it, you just have to make sure the variables being looked 
up are the same size.  There was some goofy example about several trailing 
percent signs.

Note:  Debug did use arrival access path.  But that may be because of the 
limited size of the file.  So I ran a huge insert that stuck 38k plus 
records into the file.  Now when I run
SELECT * FROM ROB/XYZ1 WHERE NAME LIKE 'ROB            '
....+....1....+ 
NAME 
ROB 
********  End of data
and debug shows
Access path of file XYZ1L1 was used by query.

So carry on

SELECT * FROM ROB/XYZ1 WHERE NAME LIKE 'ROB%'
....+....1....+
NAME 
ROB 
ROB BERENDT 
...
Access path of file XYZ1L1 was used by query.

SELECT * FROM ROB/XYZ1 WHERE NAME LIKE '%ROB%'
...  lots of records ...
Arrival sequence access was used for file XYZ1.

So, as usual, I am right.  It's the leading percent sign that barfs it. 
:-)


Rob Berendt
-- 
Group Dekko Services, LLC
Dept 01.073
PO Box 2000
Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com






Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact