Indeed; This is a documented change with ASE 11.5 onwards where the behavior of many of the string functions is different because of a rewrite to conform with ANSII standards. See
What's New in Sybase(R) Adaptive Server(TM) Enterprise? (Document ID: 36440-01-1150)
Chapter 2 System Changes in Adaptive Server Release 11.5
Trailing Spaces of char Data No Longer Truncated in String Functions
The following example demonstrates this change in behavior:
Code:
select 'x'+upper(convert(char(5),'abc'))+'x'
Pre-11.5 releases produced a char(5): "xABCx".
Adaptive Server produces a char(7): "xABC x".
Boot up ASE with traceflag 4048 which revert trailing space and datalength function behavior to that of pre-11.5.
Not suggested as this traceflag may be removed in the future release.
use varchar instead e.g.
Code:
select 'x'+upper(convert(varchar(5),'abc'))+'x'
However, Trace Flag 4048 is still in the ASE 12.5.1 codeline.