Concatenate the column values together

Ddd
Posted by Ddd under Sql Server category on | Points: 40 | Views : 1757
This code will display 1,2,3,4,5,6,7,8 in one cell in the resultset
result will be the heading of the column

declare
@a varchar(100)
select @a=COALESCE(@a + ',', '') +convert(varchar(3),categoryid) from categories
select result=@a

Comments or Responses

Login to post response