PRSQL9202007: Conversion Incorrectly Handles Trailing Blanks

ID Number: Q80639

1.11 4.20

OS/2

buglist1.11 buglist4.20

Summary:

Problem ID: PRSQL9202007

SYMPTOMS

In the following sequence of statements

create table test (col1 char(10))

go

insert into test values ('ab cd ef ')

go

select convert(varchar(3), col1) + 'Hello' from test

go

the SELECT statement should return "ab Hello". However, it

incorrectly returns "abHello "; that is, the trailing blank

resulting from convert(varchar(3), col1) is moved to the end of the

concatenated string.

WORKAROUND

To work around this problem, convert to char instead of to varchar.

STATUS

Microsoft has confirmed this to be a problem in SQL Server versions

1.11 and 4.2. We are researching this problem and will post new

information here as it becomes available.

Additional reference words: 1.11 4.20