Your CASE...ELSE
is 123, which is an integer. This takes precedence over varchar
datatype. You are seeing the error as SQL Server is trying to convert your other values to integer datatype. Enclosing the ELSE
value in single quotes should resolve this issue
declare @var varchar(10)='a'
select case @var
when 'a' then 'hi'
when 'b' then 'hello'
else '123'
end