【发布时间】:2021-01-04 03:29:20
【问题描述】:
我想选择除 InEx 值为“已排除”的元素以外的元素。
这是我的 XML 文档:
<MachineStatus>
<ShiftStop MachineName="01" InEx="Excluded" />
<ShiftStop MachineName="01" InEx="Included" />
<ShiftStop MachineName="01" InEx="Included" />
</MachineStatus>
我需要得到
<ShiftStop MachineName="01" InEx="Included" />
<ShiftStop MachineName="01" InEx="Included" />
我试过这个查询,但它不起作用。
SELECT [Entity].query('/MachineStatus/ShiftStop') FROM [FES].[SMD].[Machine] WHERE
[Entity].value('(/MachineStatus/ShiftStop/@InEx)[1]','varchar(10)') != 'Excluded'
【问题讨论】:
标签: sql-server xml xpath xpathquery