1
Reply

Concatenation with char variable in SQL Server doesn't work?

Rahul Bansal

Rahul Bansal

Aug 19 2014 12:43 AM
773
 For example:-
 
declare @a char(4)
set @a='ab'
set @a=@a+'c'
print @a
 
--it gives the output 'ab' but if declare the @a as varchar like
 
declare @a varchar(4)
set @a='ab'
set @a=@a+'c'
print @a
 
--then  it gives the output 'abc'
 
 
 

Answers (1)