CASE

Examples

MS-SQL

SELECT VM_type = CASE virtual_machine_type 

                    WHEN 0 THEN 'None'

                    WHEN 1 THEN 'Hypervisor'

                    WHEN 2 THEN 'Other'

                    ELSE 'Error'

                 END,

FROM   sys.dm_os_sys_info;

GO

CASE eventsubclass   WHEN 0 THEN 'Begin'   WHEN 1 THEN 'Commit'   ELSE CAST(eventsubclass AS VARCHAR)END AS [EventSubClass]

Bibliography