Below is subquery method that separates the strings:
SELECT
bo.value('ID[1]', 'int') AS ID
, STUFF(
(SELECT ' ' + Detail.value('.', 'varchar(MAX)')
FROM Detail_List.nodes('Detail') AS Detail_List(Detail)
FOR XML PATH('')), 1, 1, '') AS DETAIL
FROM @x.nodes('/bo') AS xml(bo)
CROSS APPLY bo.nodes('./Detail_List') AS bo(Detail_List);
Dan Guzman, SQL Server MVP, http://www.dbdelta.com
No comments:
Post a Comment