Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with a union statement
Message
From
20/12/2001 18:14:42
 
 
To
20/12/2001 17:50:56
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00596962
Message ID:
00597079
Views:
22
>>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform