Quantcast
Channel: SCN: Message List - SAP Adaptive Server Enterprise (SAP ASE) for Custom Applications
Viewing all articles
Browse latest Browse all 3587

Re: LIKE bug in ASE 15.0.3?

$
0
0

The root of the behavior lies in the sort order.

 

I've installed a new 1503 ASE with cp850 and a dictionary sort order and see the reported behavior.

 

Adaptive Server Enterprise/15.0.3/EBF 16381/P/Sun_svr4/OS 5.8/ase1503/2669/32-bit/FBO/Wed Nov 12 07:49:03 2008

 

if "Jones" like "%[QRS]%" print "yes" else print "no"

if "Jones" like "%[Q-S]%" print "yes" else print "no"

if "Jones" like "%[QRST]%" print "yes" else print "no"

if "Jones" like "%[Q-T]%" print "yes" else print "no"
go
no
no
no
yes

 

Looking at the output of sp_helpsort [particularly the part of the output that John unfortunately clipped out ], I see this:

 

------------------------------------------------------------------

     ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | }

   ~      ?                     ? ? ? ? ?   ? ? ? ?     ? ? ? ? ?

   ? ? ? ? ? ? ? ? ?   ? ? ? ?   ?           ?

     ?   0 1 2 3 4 5 6 7 8 9 A             a                 B b C

     c   D d     E         e         F f G g H h I         i

     ? J j K k L l M m N n     O           o           P p Q q R r

   S s   T t U         u         V v W w X x Y   y     Z z

 

Now, consider the ranges "%[Q-S]%"  and "%[Q-T]%".   The difference is that the second one causes characters 's' and 'T' to be included in the range, and 's' is the last character in "Jones", so it matches.

 

In other words, under this dictionary sort order, [Q-T] is equivalent to [QqRrSsT] rather than [QRST].   

 

1>  if "Jones" like "%[Q-T]%" print "yes" else print "no"

2>  if "Jonet" like "%[Q-T]%" print "yes" else print "no"

3>  if "Jonet" like "%[Q-U]%" print "yes" else print "no"

4> go

yes

no

yes

 

 

-bret


Viewing all articles
Browse latest Browse all 3587

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>