将用逗号分隔的字符串转换为列表 [英] Convert String separated with comma to list
本文介绍了将用逗号分隔的字符串转换为列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
转换``xxx,yyy,zzz''
变成"xxx","yyy","zzz"
通过sql 2008
解决方案
检查此链接
http://博客. msdn.com/b/amitjet/archive/2009/12/11/sql-server-comma-separated-string-to-table.aspx [ 解决方案
check this link
http://blogs.msdn.com/b/amitjet/archive/2009/12/11/sql-server-comma-separated-string-to-table.aspx[^]
The question, answered:
DECLARE @strIn [nvarchar](2008) SET @strIn = ''xxx,yyy,zzz''
A SELECT query:
SELECT REPLACE(REPLACE(REPLACE(@strIn,'','','''''',''''''),''xxx'''''',''''''xxx''''''),''''''zzz'',''''''zzz'''''') As [simple]
If I misunderstood, I wouldn''t post this as an answer.
[simple] ~~~~~~~~~~~~~~~~~ ''xxx'',''yyy'',''zzz''
这篇关于将用逗号分隔的字符串转换为列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文