I'm trying to add a delimiter between the data that is being combined in a single column and having a lot of trouble trying to do so.
I'm working from a large XML file (8+ megs) and trying to get pieces of the data combined down to single columns for my database. The below query is doing this (sort of) but there is no separation of the data currently.
WITH XmlFile (Contents) AS (
SELECT CONVERT (XML, BulkColumn)
FROM OPENROWSET (BULK 'C:\test.xml', SINGLE_BLOB) AS XmlData
)
SELECT c.value('(name)[1]', 'varchar(max)') AS [Name],
c.value('(stuff)[1]', 'varchar(max)') AS [Stuff]
FROM XmlFile CROSS APPLY Contents.nodes ('(/root/item)') AS t(c)
test.xml file:
<root>
<item>
<name>Something</name>
<stuff>
<note>Test 123</note>
<note>Another Test</note>
</stuff>
</item>
</root>
What it's returning:

Which is almost what I want! both note nodes have been merged into a single column... But I can't figure out howto add a delimiter between the values "Test 123 , Another Test"
Any help would be greatly appreciated!