Home > Database > Mysql Tutorial > SqlServer下通过XML拆分字符串的方法

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

WBOY
Release: 2016-06-07 18:00:59
Original
1465 people have browsed it

SqlServer中通过XML拆分字符串,需要的朋友可以参考下。

代码如下:
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)
)
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template