当前位置: 数据库>sqlserver
SqlServer下通过XML拆分字符串的方法
来源: 互联网 发布时间:2014-09-05
本文导语: 代码如下: DECLARE @idoc int; DECLARE @doc xml; set @doc=cast(''+replace(@SelectedProjectArray,',','')+'' as xml) EXEC sp_xml_preparedocument @Idoc OUTPUT, @doc SELECT ProjID FROM OPENXML (@Idoc, '/Root/item',2) WITH ( [ProjID] varchar(10) )
代码如下:
DECLARE @idoc int;
DECLARE @doc xml;
set @doc=cast(''+replace(@SelectedProjectArray,',','')+'' as xml)
EXEC sp_xml_preparedocument @Idoc OUTPUT, @doc
SELECT ProjID FROM OPENXML (@Idoc, '/Root/item',2)
WITH (
[ProjID] varchar(10)
)