create table Test
(
ID int primary key identity(1,1),
[Type] nvarchar(50)
)
insert into Test([Type]) values('SW');
insert into Test([Type]) values('ZW');
insert into Test([Type]) values('XW');
insert into Test([Type]) values('WS');
select * from Test;
select ID,[Type],case [Type]
when 'SW' then '上午'
when 'ZW' then '中午'
when 'XW' then '下午'
else '晚上' end as [ChineseType]
from Test;sql case when
最新推荐文章于 2024-06-29 15:12:22 发布
本文介绍了一个SQL案例,包括如何创建一个简单的表、插入数据并使用CASE语句进行数据转换。通过这个例子,读者可以了解到基本的SQL操作及如何用CASE语句将英文类型转换为中文类型。
2510

被折叠的 条评论
为什么被折叠?



