I'm trying to return a specific output value based on a given input value. However, I can't get the CASE statement to work.. What am I doing wrong?
Code:
CREATE FUNCTION ConvertId(@id as tinyint)
RETURNS tinyint
AS
BEGIN
DECLARE @newId AS tinyint
SET @newId = @id
CASE @newId
WHEN 1 THEN 72
WHEN 2 THEN 5
WHEN 3 THEN 6
WHEN 4 THEN 19
WHEN 5 THEN 9
WHEN 6 THEN 17
WHEN 7 THEN 18
WHEN 8 THEN 10
WHEN 9 THEN 7
WHEN 10 THEN 8
RETURN @newId
END