The accepted answer to this question claims that using a char column will preserve all filling spaces in a string in Sybase, but that is not the behavior I am seeing (unless I'm mistaken about what 'filling spaces' means). For example, when I run the following script:
create table #check_strings
(
value char(20) null
)
insert into #check_strings values (null)
insert into #check_strings values ('')
insert into #check_strings values (' ')
insert into #check_strings values (' ')
insert into #check_strings values ('blah')
insert into #check_strings values ('blah ')
insert into #check_strings values ('blah ')
insert into #check_strings values (' blah ')
select value, len(value) from #check_strings
I get the following output:
[NULL] - [NULL]
[single space] - 1
[single space] - 1
[single space] - 1
blah - 4
blah - 4
blah - 4
[four spaces]blah - 8
Is there any way to get Sybase to not strip off trailing spaces? Additionally, is there any way to get it to save an empty string as an empty string, and not as a single space?
I'm using Sybase 15.5.