例如数据 列Name
name
a
b
c
d
a
b
c
d
最后的结果
a*b*c*d*
declare @test table( namevarchar(10))
insert into @testvalues(‘a’),(‘b’),(‘c’),(‘d’);
select distinct
(select cast(name asvarchar(2))+’*’from @test for xml path(”))as name from @test
输出结果:
(4 row(s) affected)
name
————————————————–
a*b*c*d*
(1 row(s) affected)
name
————————————————–
a*b*c*d*
(1 row(s) affected)
本文来源:https://www.yuntue.com/post/234840.html | 云服务器网,转载请注明出处!

微信扫一扫打赏
支付宝扫一扫打赏