我正在尝试根据变量的值添加 CASE 语句:
WHERE DTH.PointPerson LIKE @userParam
AND ActivityDate >= @startDateParam
AND ActivityDate <= @endDateParam
--new section below
AND CASE (@orgTeamPK)
WHEN '%' THEN
(USR.[OrganizationalTeamId] LIKE @orgTeamPK OR USR.[OrganizationalTeamId] IS NULL)
ELSE
(USR.[OrganizationalTeamId] LIKE @orgTeamPK)
但是我的语法似乎关闭了。我如何实现上面想要做的事情?