欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

SqlServer下通过XML拆分字符串的方法

程序员文章站 2023-12-11 16:56:22
复制代码 代码如下: declare @idoc int; declare @doc xml; set @doc=cast('
复制代码 代码如下:

declare @idoc int;
declare @doc xml;
set @doc=cast('<root><item><projid>'+replace(@selectedprojectarray,',','</projid></item><item><projid>')+'</projid></item></root>' as xml)
exec sp_xml_preparedocument @idoc output, @doc

select projid from openxml (@idoc, '/root/item',2)
with (
[projid] varchar(10)
)

上一篇:

下一篇: