>Hi Hilmar,
>
>> LEFT() is unrealiable in this case
>
>If you found a SELECT example where it is unreliable, post it.
>
>I think you cannot found one.
>
>Otherwise you think that I would have written this?
>
>Fabio
As I said, for variable-length expressions.
FullName = padr("Zonneveld, Hilmar", 30)
? left(alltrim(fullname), 5)
? len(left(alltrim(fullname), 5))
FullName = space(30)
? left(alltrim(fullname), 5)
? len(left(alltrim(fullname), 5))
The resulting variable length can cause problems in some cases, like indexing. In your SELECT example, if the first record in the table happens to be empty, the length of the resulting expression will cause problems.
I have no objection to using left() (or right(), or substr()) with fixed-length expressions. It is only for variable-length expressions that I use padr(), in certain cases, to ensure that the result has a fixed-length.
For me, these cases typically include: selection of data that includes alltrim(); alignment of data in reports.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)