Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE FUNCTION ufn_GetSalaryLevel (@salary DECIMAL(18,4))
- RETURNS varchar(10) AS
- BEGIN
- DECLARE @SalaryLevel VARCHAR(10)
- SET @SalaryLevel =
- CASE
- WHEN @salary < 30000 THEN 'Low'
- WHEN @salary > 50000 THEN 'High'
- ELSE 'Average'
- END
- RETURN @SalaryLevel
- END;
- SELECT Salary, dbo.ufn_GetSalaryLevel(Salary) AS [Salary Level]
- FROM Employees
- GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement