Rahul Bansal

Rahul Bansal

  • 105
  • 17.1k
  • 10m

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)