Rahul Bansal

Rahul Bansal

  • 110
  • 17.1k
  • 9.9m

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

Aug 19 2014 12:43 AM
 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)