>>>Good point. I did what you suggest and the value in the column for LEN(ALLTRIM(REFERENCE)) shows the actual number of characters in the field. And yet, when I REPLICATE with the 10-.... or 15--... it does not work.
>>>Thanks
>>
>>
>>SELECT REFERENCE, Cast(REPLICATE(' ',15-LEN(ALLTRIM(REFERENCE))) + ' ' AS c(100)) as TEST FROM WO_REFER
>>
>
>Strange results. When I do the CAST() as you suggested and leave the number in REPLICATE to be 15, the resulting column TEST has the correct number of the 'nbsp'. That is, if the value in the field is 'A', the value in the TEST is 14 strings of 'nbsp'
>But if I change the 15 with 10, error "String too long to fit"
Strange. Try to change c(100) to c(150), just to test. Or c(200).