Building a comma separated list?

前端 未结 9 1485
说谎
说谎 2020-11-30 08:49

I\'m tryin to use SQL to build a comma separated list of cat_id\'s

the code is:

declare     @output varchar(max)
set         @output = null;
select @         


        
9条回答
  •  囚心锁ツ
    2020-11-30 09:21

    Not sure if this applies exactly to what you're looking for, but I found this right at the same time I found your questions. I use the second solution with FOR XML PATH, which Matt Hamilton mentioned above. It's worked great for me.

    Concatenating Rows - By Carl P. Anderson, 2009/10/14

    http://www.sqlservercentral.com/articles/T-SQL/67973/

提交回复
热议问题