General information
Category:
Coding, syntax & commands
>>>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only