Monday, April 28, 2008

Case Statement adding description

Case statements I created to add an actual description in place of a integer value Devs used.

CASE b.Status
When 1 then 'Pending'
When 2 then 'Submitted'
When 3 then 'Rejected'
When 4 then 'Posted'
When 5 then 'Processed'
When 6 then 'Confirmed'
Else '0'
End as 'Status',


CASE c.AnniversaryMonth
WHEN 1 THEN 'January'
WHEN 2 THEN 'February'
WHEN 3 THEN 'March'
WHEN 4 THEN 'April'
WHEN 5 THEN 'May'
WHEN 6 THEN 'June'
WHEN 7 THEN 'July'
WHEN 8 THEN 'August'
WHEN 9 THEN 'September'
WHEN 10 THEN 'October'
WHEN 11 THEN 'November'
WHEN 12 THEN 'December'
ELSE '0'
END AS 'AnniversaryMonth',

No comments: