Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with a union statement
Message
De
20/12/2001 18:14:42
 
 
À
20/12/2001 17:50:56
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00596962
Message ID:
00597079
Vues:
24
>>>Your right, one of the fields had a different length. So much for trusting the word of others....Thanks again.
>>
>>Kirk --
>>
>>And what I'm sure you're about to do, for the benefit of curious lurkers, is to use a LEFT (myLongerField, LengthOfShorterField) as an expression in the appropriate SELECT, to get those field lengths in sync.
>
>I prefer PADR() just because it will give me the proper length even if its parameter is shorter. IOW, left("abc", 8) will have a length of 3, but padr("abc",8) will have 8. Saves some looking up the table structures, and saves from some of changes in their structure.

I agree. I think it's a good practice to take maintenance into consideration and not just address the immediate need. Pity the poor maintenance programmer, who often is us <g>.

Your solution might well place the PADR() expression on both fields in each select.

As you note, some modifications, especially making the length of one field greater than the current max length of either, would require more extensive work. But, defining the max length of those fields as a defined constant would minimize the amount of changes needed in expressions like this.

Jay
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform