Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SELECT-Sql Order By question
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00751979
Message ID:
00751994
Vues:
22
It doesn't work because you needlessly use ALLTRIM on the fields. VFP doesn't've variable lenght character field, so it used one of the source table records to determine the lenght of UpperLast and UpperFirst columns in the result that. Depending on the values on those fields on that records, the result columns could be shorter than source columns.
SELECT UPPER(MyTable.Last) AS UpperLast, ;
    UPPER(MyTable.First) AS UpperFirst ;
    ORDER BY UpperLast, UpperFirst ;
    INTO TABLE THISFORM.MyTableFolder+'MyTable'
As a rule, don't use ALLTRIM() in select statements on the table fields. If you do, consider what sideeffects they could cause.

>I have one more SELECT-Sql question that perhaps someone can help me with.
>
>I would like to ORDER by a last name and first name field. However, I need this in upper case so they order correctly. Is this possible? or do I just need to index the result of the cursor?
>
>I did something like:
>
>SELECT ALLTRIM(UPPER(MyTable.Last)) AS UpperLast, ;
>    ALLTRIM(UPPER(MyTable.First)) AS UpperFirst ;
>    ORDER BY UpperLast, UpperFirst ;
>    INTO TABLE THISFORM.MyTableFolder+'MyTable'
>
>which doesn't work.
>
>Thanks for the help.
>
>Mel Cummings
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform