首页 > 数据库 >sql 拼接字符串xml转行

sql 拼接字符串xml转行

时间:2023-01-28 22:01:13浏览次数:40  
标签:xml 转行 ids value sql tb SELECT

DECLARE @ids VARCHAR(2200) ='a,c,d,e,f,g'
                                        SELECT  c.value('.','varchar(50)') AS id
                                        FROM    (
                                                 SELECT CAST('<r>'
                                                        + REPLACE(@ids,',',
                                                              '</r><r>')
                                                        + '</r>' AS XML) AS value
                                                ) tb
                                        CROSS APPLY tb.value.nodes('*') t (c)

 

标签:xml,转行,ids,value,sql,tb,SELECT
From: https://www.cnblogs.com/zengtianli/p/16738925.html

相关文章