DECLARE @strID VARCHAR(200) = '1,2,3';
DECLARE @xml XML;
SELECT @xml
= CONVERT(XML, '<root><place><id>' + REPLACE(@strID, ',', '</id></place><place><id>') + '</id></place></root>');
IF OBJECT_ID('tempdb..#Temp') IS NOT NULL
BEGIN
DROP TABLE #Temp;
END;
SELECT T.C.value('id[1]', 'varchar(36)') AS ID
INTO #Temp
FROM @xml.nodes('/root/place') AS T(C);
SELECT ID
FROM #Temp;
标签:XML,xml,strID,Temp,Server,SQL,DECLARE,SELECT From: https://www.cnblogs.com/bzpfly/p/17001899.html