-- Collection of code snippets by Arne Vajhøj 
-- posted to eksperten.dk, usenet and other places (2002-now) 
CREATE FUNCTION y1(@S VARCHAR) RETURNS INTEGER
AS
BEGIN
   RETURN CASE @S
             WHEN 'Y' THEN 1
             ELSE 0
          END
END
