我有以下 sql 代码:
declare @x xml
set @x =
'<ResultBlock>
<MatchSummary matches="1"><TotalMatchScore>900</TotalMatchScore>
<Rules totalRuleCount="9">
<Rule ruleCount="1" isGlobal="1">
<RuleID>MA_SWTEL_DEMP_DEADD</RuleID>
<Score>100</Score>
</Rule>
<Rule ruleCount="1" isGlobal="1">
<RuleID>MA_MS</RuleID>
<Score>100</Score>
</Rule>
<Rule ruleCount="1" isGlobal="1">
<RuleID>MA_PAS_MS</RuleID>
<Score>100</Score>
</Rule>
<Rule ruleCount="1" isGlobal="1">
<RuleID>MA_CTEL_MS</RuleID>
<Score>100</Score>
</Rule>
<Rule ruleCount="1" isGlobal="1">
<RuleID>MA_REF</RuleID>
<Score>100</Score>
</Rule>
<Rule ruleCount="1" isGlobal="1">
<RuleID>MA_PAS_REF</RuleID>
<Score>100</Score>
</Rule>
<Rule ruleCount="1" isGlobal="1">
<RuleID>MA_CTEL_REF</RuleID>
<Score>100</Score>
</Rule>
<Rule ruleCount="1" isGlobal="1">
<RuleID>MA_MS_PER</RuleID>
<Score>100</Score>
</Rule>
<Rule ruleCount="1" isGlobal="1">
<RuleID>MA_REF_PER</RuleID>
<Score>100</Score></Rule>
</Rules>
<MatchSchemes schemeCount="1">
<Scheme>
<SchemeID>7</SchemeID>
<Score>900</Score>
</Scheme>
</MatchSchemes>
</MatchSummary>
<ErrorWarnings>
<Errors errorCount="0" />
<Warnings warningCount="0" />
</ErrorWarnings>
</ResultBlock>'
select x.value(N'RuleID', N'varchar(50)') as RuleID
from @x.nodes(N'//RuleID') t(x)
我需要检索所有RuleID
的。但是以下查询会产生错误:
XQuery [value()]: 'value()' requires a singleton (or empty sequence), found operand of type 'xdt:untypedAtomic *'
. 可能有什么问题?