It's incorrect use of the CASE function which is designed to return one value based on some conditions. It's similar to VFP IIF() function but more powerfull.
Here how your WHERE clause can be re-written.
WHERE (@notplinid=1 AND (plinid like @plinid+'%' or @plinid = ''))
OR (@notplinid <> 1 AND plinid not like @plinid+'%')
>I'll have to check out the SQL execution planning
>
>I know I can do it dynamically very easily...I just thought that doing it without might be faster...I think I'll try both to see if there is any difference.
>
>This is what its suppose to be, but I'm still getting an error at the "like"?
>
> case @notplinid
> when 1 then (plinid like @plinid+'%' or @plinid = '')
> else (plinid not like (@plinid+'%'))
> end
--sb--