CREATE PROC usp_case

     @userName nvarchar(10)

AS

 DECLARE @bYear INT 

 DECLARE @tti NCHAR(3) -- 띠

 SELECT @bYear = birthYear FROM userTbl

  WHERE name = @userName;

 SET @tti =

  CASE

   WHEN ( @bYear%12 =  0) THEN '원숭이'

   WHEN ( @bYear%12 =  1) THEN '닭' 

   WHEN ( @bYear%12 =  2) THEN '개' 

   WHEN ( @bYear%12 =  3) THEN '돼지' 

   WHEN ( @bYear%12 =  4) THEN '쥐' 

   WHEN ( @bYear%12 =  5) THEN '소' 

   WHEN ( @bYear%12 =  6) THEN '호랑이' 

   WHEN ( @bYear%12 =  7) THEN '토끼' 

   WHEN ( @bYear%12 =  8) THEN '용' 

   WHEN ( @bYear%12 =  9) THEN '뱀' 

   WHEN ( @bYear%12 =  10) THEN '말' 

   ELSE '양'

  END;

 PRINT @userName + '의 띠==> ' + @tti;



+ Recent posts