I didn't quite follow the logic you are trying to implement, but SQL Server does not like the way you are using the case expression. Perhaps something like this?WHERE
( CONVERT(SMALLINT, LEN(@strPmtModeId)) > 2 AND ISNULL(Pmt_Mode_Id, 99) IN (@LeftInt, @RightInt) )
OR
@strPmtModeId IS NULL
--- OR ???