我在 SQL Server 2005 中有一个 XML 列:
<treatmentDetails>
<treatmentFactor>
<treatmentFactorName>Varieties</treatmentFactorName>
<plot>Whole</plot>
<levels>
<level>Var1</level>
<level>Var2</level>
</levels>
</treatmentFactor>
<treatmentFactor>
<treatmentFactorName>Nitrogen</treatmentFactorName>
<plot>Whole</plot>
<levels>
<level>N1</level>
<level>N2</level>
<level>N3</level>
</levels>
</treatmentFactor>
</treatmentDetails>
由此,我想创建这样的输出:
Varieties Nitrogen
Var1 N1
var1 N2
var1 N3
var2 N1
var2 N2
var3 N3
我尝试使用xmlfield.query
or .value
,但我能够提取单个值(例如 Var1)或 XML 标记,<level>Var1</level>
......任何帮助都会有很大帮助。