WHERE Clause based on CASE Expression
I am trying to add a CASE expression based on the value of a variable:
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)
However my syntax appears to be off. How do I achieve what I am trying to do above?