Are there some command in SQL that is similar to the Select Case in VB?
Thanks.
Printable View
Are there some command in SQL that is similar to the Select Case in VB?
Thanks.
Of course there is:
you can use it this way
SELECT FieldName = CASE MonthValue 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'
END