码迷,mamicode.com
首页 > 数据库 > 详细

SQL Server 将某一列的值拼接成字符串

时间:2017-03-17 13:29:47      阅读:227      评论:0      收藏:0      [点我收藏+]

标签:margin   tab   style   weight   code   idt   height   ble   class   

名称

海鲜水产

水果蔬菜

海参

肉禽蛋

牛排

腊味

生鲜食品

将以上一列变成:

生鲜食品,海鲜水产,水果蔬菜,海参,牛排,肉禽蛋,腊味

sql

select CAST(列 as varchar)+, fromas gt where gt.Code=1 for xml path(‘‘) 

 

SQL Server 将某一列的值拼接成字符串

标签:margin   tab   style   weight   code   idt   height   ble   class   

原文地址:http://www.cnblogs.com/asd14828/p/6565537.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!