Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

sql server: how to concatenate column data using comma

declare @aa varchar (200)
set @aa = ''

select @aa = 
    case when @aa = ''
    then CarName
    else @aa + coalesce(',' + CarName, '')
    end
  from Cars

print @aa
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sql #concatenate #column #data #comma
ADD COMMENT
Topic
Name
7+1 =