Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
String comparisons in SQL SELECT
Message
De
29/05/2002 05:33:58
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00661853
Message ID:
00662334
Vues:
19
>Thanks a lot, this clears up a number of things for me.
>
>Just one more question on this:
>
>can I get the equivalent of using == with a BETWEEN statement? as I get the same problem when using BETWEEN, preferably without SET ANSI ON as it may affect older code.
>
>TIA, Craig.

With or w/o ansi no. Strings are included in a alphabetic sort order and it would mean '2' would come after '103' and before '210' :
myField between '103' and '210'
would get that '2' too. If that's what you really want then OK. I see that you use '103' in your sampling and thus I suspect all are somewhat numeric values. If so then you might be much more comfortable using val() instead :

where val(myField) = 103
where val(myField) between 103 and 210

If field contains some char too (ie: 103, 103R, 19B) you might then make it still numeric sort ordered with functions like padl(), chrtran().
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform