CASE 函数将某个表达式与一组简单表达式进行比较以确定结果。
例如
select
Name,
( CASE Sex
WHEN '0' then '男'
WHEN '1' then '女'
ELSE 'Unknown'
END ) as Sex,
IdentificationCard,
convert(nvarchar(10),BirthDate,120) as BirthDate
from
Personinfo
例如
select
Name,
( CASE Sex
WHEN '0' then '男'
WHEN '1' then '女'
ELSE 'Unknown'
END ) as Sex,
IdentificationCard,
convert(nvarchar(10),BirthDate,120) as BirthDate
from
Personinfo