@MallUnit is a parameter with value ‘Unit 401,Unit 402,Unit 403’
I would like to have a conditional where statement. Assume that before the AND there are other conditions that work just fine. Basically, if ScheduledMallUnitTypeID is null evaluate using the IN condition. Otherwise, use the like clause.
AND
CASE ScheduledMallUnitTypeID IS NULL THEN
ScheduledMallUnitTypeID IN
(
SELECT Value
FROM Toolbox.dbo.ReportingPortalMultiSetParameterFix(@MallUnit)
)
ELSE ScheduledMallUnitTypeID LIKE @MallUnit
END
This would work: