Suppose a table has firstname and lastname as its fields and we want to show full name on the screen or in a report. The first expression that comes to mind is like :
SELECT TRIM(lastname)+' , ' + firstname from table .......
SELECT ALLTR(lastname)+' , ' + firstname from table .......
However a easier way is :-
SELECT lastname - (', '+firstname) from table .........
The ‘-‘ is a another concatenation operator that removes trailing blanks from the element preceding the operator then joins two elements NOTE :-
Note that there is a difference between using the ‘-‘ operator and ALLT in the above example.
The latter removes all blanks from last name while the former moves the trailing blanks from last name and adds them to the end of the resulting expression.
This is handy if you want the size of the resulting field to be equal to the total size of its elements..