使用sql stuff函数

/*         stuff(param1, startIndex, length, param2)
说明:将param1中自startIndex(SQL中都是从1开始,而非0)起,删除length个字符,然后用param2替换删掉的字符。*/

 

示例:

select  po_no = stuff((select ';' + 字段 from 表 t where 查询条件 for xml path('')) , 1 , 1 , '') 

posted on 2016-09-28 11:35  水涧无恒  阅读(5980)  评论(0编辑  收藏  举报