CASE
Examples
Examples
MS-SQL
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
Bibliography
MS-SQLhttps://docs.microsoft.com/en-us/sql/t-sql/language-elements/case-transact-sql?view=sql-server-ver15https://learn.microsoft.com/en-us/sql/t-sql/language-elements/case-transact-sql?view=sql-server-ver16https://stackoverflow.com/questions/5642165/sql-how-use-case-and-cast-in-a-query
Oraclehttps://www.oracletutorial.com/oracle-basics/oracle-case/
Oraclehttps://www.oracletutorial.com/oracle-basics/oracle-case/