i came to know that the below sql can be used to extract data from xml
--XML DATA SAMPLE
DECLARE @xmlvar xml
SET @xmlvar='
<NewDataSet>
<param>
<SearchField>JID</SearchField>
<FilterCondition>%</FilterCondition>
<ConditionData>4000</ConditionData>
<MatchCase>0</MatchCase>
<Table>MyTableName</Table>
</param>
<param>
<SearchField>Specialist</SearchField>
<FilterCondition>=</FilterCondition>
<ConditionData>Nigel Graham</ConditionData>
<MatchCase>0</MatchCase>
<Table>MyTableName</Table>
</param>
</NewDataSet>'
SELECT A.B.value('(SearchField)[1]', 'VARCHAR(255)' ) SearchField,
A.B.value('(FilterCondition)[1]', 'VARCHAR(25)' ) Operator,
A.B.value('(ConditionData)[1]', 'VARCHAR(MAX)' ) ConditionData,
A.B.value('(MatchCase)[1]', 'BIT' ) MatchCase,
A.B.value('(Table)[1]', 'VARCHAR(MAX)' ) TableName
FROM @WhereClause_XML.nodes('/NewDataSet/param') A(B)
the above xml is working but i am not familiar with the above type of sql. so please tell me what is the meaning of (FilterCondition)[1] or (ConditionData)[1] why bracket [1] why not bracket [0] or [2].
please explain me how above xml works. thanks