MS SQL has a convenient workaround for concatenating a column value from multiple rows into one value:
SELECT col1 FROM table1 WHERE col2 = \'x\' ORDER by col
DECLARE @XmlData XML; SET @XmlData = ( SELECT * FROM [dbo].[TABLE1] FOR XML PATH('ChildNodeDetailsResponse') ,ROOT('ParentNode') ) SELECT @XmlData AS Result