Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Inline formatting in SQL selects-more strange VFP behavi
Message
De
27/04/2001 03:16:50
 
 
À
27/04/2001 01:25:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00499921
Message ID:
00500533
Vues:
21
Arne,
It's quite simple actually. FoxPro doesn't ignore the blanks, but a blank character corresponds to CHR(32) which is lower than any digits or characters. To demonstrate, try the following:
CREATE CURSOR somefile (LINE c(2))

INSERT INTO somefile VALUE(" A")
INSERT INTO somefile VALUE("AA")
INSERT INTO somefile VALUE(" Z")
INSERT INTO somefile VALUE("ZZ")
INSERT INTO somefile VALUE(" 0")
INSERT INTO somefile VALUE(" 1")
INSERT INTO somefile VALUE(" a")
INSERT INTO somefile VALUE(" b")

SELECT PADR(ALLTRIM(line), 2) AS cSortFld,;
       line,;
       ASC(LEFT(line, 1)) + ASC(RIGHT(line, 1)) AS nAsc;
 FROM somefile;
 ORDER BY 1;
INTO CURSOR CaseSensitive

SELECT PADR(ALLTRIM(UPPER(line)), 2) AS cSortFld,;
       UPPER(line), ASC(LEFT(UPPER(line), 1)) + ASC(RIGHT(UPPER(line), 1)) AS nAsc;
 FROM somefile;
ORDER BY 1;
INTO CURSOR CaseInsensitive
>Daniel,
>
>(Also: thanks, Sylvain)
>
>>Try:
>>

>>SELE PADR(ALLTRIM(line),2) FROM somefile ORDER BY 1
>
>Of course you mean PADL :)
>
>Thanks, that did work, but I can't quite figure out why. Why is this any different from just PADL(Line,2)?
>
>-Arne
Daniel
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform