函数
stuff(param1, startIndex, length, param2)函数说明将param1中自startIndex(SQL中都是从1开始,而非0)起,删除length个字符,然后用param2替换删掉的字符。例子
我有个#tmp1 的表,内容为
执行下面语句
SELECT PRODID,KTL_CustRef, PO = stuff ((SELECT ' ' + PO FROM #tmp1 AS t WHERE t .PRODID = tb.PRODID FOR xml path('')), 1, 1, '')FROM #tmp1 tbGROUP BY PRODID,KTL_CustRef
结果为
新闻热点
疑难解答