例如数据 列Name
复制代码 代码如下:
name
a
b
c
d
最后的结果
复制代码 代码 android 如下:
a*b*c*d*
declare @test table( namevarch http://www.cppcns.com ar(10))
insert into @testvalues('a'),('b'),('c'),('d');
select python distinct
(select cast(name asvarchar(2))+'*'from @test for XML path(''))as name qCtQDo from @test
输出结果:
复制代码 代码如下:
(4 row(s) affected)
name
------------------------------------ 编程客栈 --------------
a*b*c*d*
(1 row(s) affected)
查看更多关于SQL Server把某个字段的数据用一条语句转换成字符串的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did250685