I am new to xquery in SQL Server.
I have often come across xquery expressions using [1] with attributes.
Can somebody please explain what does it mean?
Here is a example
declare @aa xml
set @aa='<data>
<row>
<Value>1</Value>
<Text>Masters</Text>
</row>
<row>
<Value>2</Value>
<Text>Transactions</Text>
</row>
<row>
<Value>3</Value>
<Text>Misch. Reports</Text>
</row>
</data>'
select a.f.value('Value[1]','varchar(50)'), -- why [1] here ?
a.f.value('Text[1]','varchar(50)') -- and here too..
from @aa.nodes('/data/row') as a(f)
Thanks n Regards