This is in the where
clause:
YEAR like '%'+@year+'%' and
@year
is an integer. So, you need to convert it to a string:
YEAR like '%'+ cast(@year as varchar(255)) + '%' and
Why you are using like
for a column called YEAR
is suspicious. Perhaps you just want:
(YEAR = @year or @year IS NULL) and