MSSQL读取xml字符串到临时表

DECLARE @hdoc int 
DECLARE @doc xml
SET @doc ='

201北京beijing1211北京北京市

1801呼和浩特huhehaote21822内蒙古自治区呼和浩特市

' 
EXEC sp_xml_preparedocument @hdoc OUTPUT, @doc 


SELECT * 
FROM openxml(@hdoc,'/CityValueSet/CityItem',2) 
WITH (CityId int,CityName VARCHAR(200),EngName varchar(100),Level int,ParentId int,Memo1 int,Memo2 int,Memo3 int,CityFullName varchar(200))

  

转载于:https://www.cnblogs.com/lijunhao/p/5564224.html

你可能感兴趣的:(MSSQL读取xml字符串到临时表)