As you know both CHAR and VARCHAR datatypes are used to store characters. While VARCHAR is preferred and used in many times to have data with varying length CHAR datatype is primarily used to have data with Fixed length. Also CHAR datatype will keep trailing spaces if the length of the data is not equal to it's size.
declare @c char(10)
set @c='test'
select @c+'a' as char_data
The result is
char_data
-----------
test a
Look at the trailing spaces after the test. Because column size is 10 and data size is 4, it keeps 6 trailing spaces. But VARCHAR datatype will not store trailing sapces as you see below
declare @c varchar(10)
set @c='test'
select @c+'a' as varchar_data
Result
varchar_data
------------
testa
But you should be aware that when values are compared in the WHERE clause trailing sapces are ignored for both of these datatyeps. Execute the following code
declare @c char(10)
set @c='test'
select @c+'a' as char_data where @c='test'
GO
declare @c varchar(10)
set @c='test'
select @c+'a' as varchar_data where @c='test'
and see the result
char_data
-----------
test a
varchar_data
------------
testa
Although @c of type CHAR stores 6 trailing spaces, when compared with 'test', the trailing spaces are ignored The same is true for the following cases too
declare @c char(10)
set @c='test'
select @c+'a' as char_data where @c='test '
GO
declare @c varchar(10)
set @c='test'
select @c+'a' as varchar_data where @c='test '
The result is
char_data
-----------
test a
varchar_data
------------
testa
So these trailing spaces may confuse you. You should always keep in mind that trailing spaces are always ingored at WHERE clause during comparision although a column contains trailing spaces or not.