You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

TFS 2018 WIQL查询LIKE条件报错:期望比较运算符,如何修正?

Fixing the "Expecting comparison operator" Error in TFS 2018 WIQL

Ah, I ran into this exact snag when working with TFS 2018 a while back! The issue here is that WIQL (Work Item Query Language) in TFS 2018 doesn't support the standard SQL LIKE operator—it uses its own set of comparison operators for string and path matching.

The Correct Operators to Use

Depending on what you're trying to achieve, you'll want to use one of these WIQL-friendly operators:

1. Match Iteration Paths Containing Specific Text

If you just need to find work items where the IterationPath includes your target string ("MY ITERATION NAME"), use the Contains operator:

SELECT [System.Id], [System.WorkItemType], [System.Title], [System.State], [System.AreaPath], [System.IterationPath] 
FROM workitems 
WHERE [System.TeamProject] = @project 
  AND [System.IterationPath] Contains 'MY ITERATION NAME' 
ORDER BY [System.IterationPath] ASC

2. Match a Parent Iteration and All Its Children

If your goal is to include work items from the target iteration and all its sub-iterations, use the Under operator instead. Just make sure to use the full path to your iteration:

SELECT [System.Id], [System.WorkItemType], [System.Title], [System.State], [System.AreaPath], [System.IterationPath] 
FROM workitems 
WHERE [System.TeamProject] = @project 
  AND [System.IterationPath] Under 'YourProjectName\Iterations\MY ITERATION NAME' 
ORDER BY [System.IterationPath] ASC

Bonus: Other Useful WIQL String Operators

TFS 2018 WIQL also supports these for more precise matching:

  • Does Not Contain: Exclude items with the target text
  • Starts With: Match paths that begin with your string
  • Ends With: Match paths that end with your string

内容的提问来源于stack exchange,提问作者TeoVr81

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.13 08:20:00