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".
DECLARE @myDoc xml
SET @myDoc =
'<Root>
<Activities>
<Activity>This is activity one</Activity>
<Activity>This is activity two</Activity>
<Activity>This is activity three</Activity>
</Activities>
</Root>'
SELECT @myDoc.value('(/Root/Activities/Activity)[1]', 'varchar(100)' )
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…