This SQL only returns the first Activity element. How do I select them all? If I remove the [1] in the query I get an error that \"value() requires a singleton\".
This works, but seems unnecessarily complex. There may be an easier way.
DECLARE @myDoc xml
SET @myDoc =
'
This is activity one
This is activity two
This is activity three
'
SELECT activity.VALUE('(//Activity)[1]','varchar(100)') AS activity
FROM (
SELECT NewTable.activity.query('.') AS activity
FROM (SELECT 1 AS col1) AS t
CROSS APPLY @myDoc.nodes('(/Root/Activities/Activity)') AS NewTable(activity)
) AS x